home *** CD-ROM | disk | FTP | other *** search
/ Windows Game Programming for Dummies (2nd Edition) / WinGamProgFD.iso / mac / DirectX SDK / DXSDK / include / DShowIDL / axextend.idl < prev    next >
Text File  |  2001-10-08  |  356KB  |  9,424 lines

  1. //------------------------------------------------------------------------------
  2. // File: AXExtend.idl
  3. //
  4. // Desc: Extended streaming interface definitions for the ActiveMovie
  5. //       streaming and synchronization architecture.  Core streaming
  6. //       interfaces are in AXCore.idl, and control interfaces for the
  7. //       type library are in Control.odl.
  8. //
  9. // Copyright (c) 1992-2001, Microsoft Corporation.  All rights reserved.
  10. //------------------------------------------------------------------------------
  11.  
  12.  
  13. // include after unknwn.idl, objidl.idl and axcore.idl
  14.  
  15. /////////////////////////////////////////////////////////////////////////////
  16. //
  17. //  Windows XP vs. DirectX 8.0 header merge
  18. //
  19. //  Separate the updated Windows XP version of this header from the downlevel
  20. //  version that shipped with the DirectX 8.0 SDK.  Since development 
  21. //  on BDA technology continued for Windows XP, some changes were made to
  22. //  this file in order to improve the interface and functionality.
  23. //
  24. //  To maintain compatibility with older applications which rely on the
  25. //  DirectX 8.0 versions of these files, the DirectX 8.1 version includes
  26. //  both the Windows XP content and the DirectX 8.0 content, which are 
  27. //  separated by the #if (WINVER >= 0x501) preprocessor directive.
  28. //
  29. //  Therefore, if you define WINVER to be 0x501 to specify Windows XP,
  30. //  the revised content will be compiled.  Otherwise, the original 
  31. //  DirectX 8.0 content will be used.
  32. //
  33. /////////////////////////////////////////////////////////////////////////////
  34.  
  35. #if (WINVER >= 0x501)    // Windows XP content
  36.  
  37.  
  38.  
  39. // forward declarations - these are the interfaces declared in this file
  40.  
  41. interface IEnumRegFilters;
  42. interface IFileSourceFilter;
  43. interface IFileSinkFilter;
  44. interface IFileSinkFilter2;
  45. interface IGraphBuilder;
  46. interface ICaptureGraphBuilder;
  47. interface ICaptureGraphBuilder2;
  48. interface IAMCopyCaptureFileProgress;
  49. interface IFilterMapper;
  50. interface IFilterMapper2;
  51. interface IMediaEventSink;
  52. interface IOverlay;
  53. interface IOverlayNotify;
  54. interface IOverlayNotify2;
  55. interface IQualityControl;
  56. interface ISeekingPassThru;
  57. interface IAMStreamConfig;
  58. interface IAMDevMemoryAllocator;
  59. interface IAMDevMemoryControl;
  60. interface IConfigInterleaving;
  61. interface IConfigAviMux;
  62. interface IAMVideoCompression;
  63. interface IAMVfwCaptureDialogs;
  64. interface IAMVfwCompressDialogs;
  65. interface IAMDroppedFrames;
  66. interface IAMAudioInputMixer;
  67. interface IAMBufferNegotiation;
  68. interface IAMAnalogVideoDecoder;
  69. interface IAMVideoProcAmp;
  70. interface IAMAnalogVideoEncoder;
  71. interface IAMCameraControl;
  72. interface IAMCrossbar;
  73. interface IAMTVTuner;
  74. interface IKsPropertySet;
  75. interface IAMPhysicalPinInfo;
  76. interface IAMExtDevice;
  77. interface IAMExtTransport;
  78. interface IAMTimecodeReader;
  79. interface IAMTimecodeGenerator;
  80. interface IAMTimecodeDisplay;
  81. interface IDrawVideoImage;
  82. interface IDecimateVideoImage;
  83. interface IAMVideoDecimationProperties;
  84. interface IAMPushSource;
  85. interface IAMAudioRendererStats;
  86. interface IAMLatency;
  87. interface IAMGraphStreams;
  88. interface IAMOverlayFX;
  89. interface IAMOpenProgress;
  90. interface IMpeg2Demultiplexer ;
  91. interface IMPEG2StreamIdMap ;
  92. interface IEnumStreamIdMap ;
  93. interface IAMClockSlave ;
  94.  
  95. //==========================================================================
  96. //==========================================================================
  97. // IEnumRegFilters interface -- enumerates registered filters.
  98. // enumerator interface returned from IFilterMapper::EnumMatchingFilters().
  99. // based on IEnum pseudo-template
  100. //==========================================================================
  101. //==========================================================================
  102.  
  103. typedef struct {
  104.     CLSID Clsid;             // class id of the filter
  105.     LPWSTR Name;             // name of filter
  106. } REGFILTER;
  107.  
  108. [
  109. object,
  110. uuid(56a868a4-0ad4-11ce-b03a-0020af0ba770),
  111. pointer_default(unique)
  112. ]
  113.  
  114. // The point of the mapper is to avoid loading filters.  By looking in the
  115. // registry we can reduce the number of filters which must be loaded and tried.
  116. // This enumerator returns descriptors of filters (including the GUIDs that
  117. // CoCreateInstance can instantiate).  The filters themselves are not loaded.
  118.  
  119. interface IEnumRegFilters : IUnknown {
  120.     import "unknwn.idl";
  121.  
  122.     // The caller must use CoTaskMemFree to free each REGFILTER* returned
  123.     // in the array.
  124.     HRESULT Next
  125.         ( [in]  ULONG cFilters,           // place this many filters...
  126.           [out] REGFILTER ** apRegFilter, // ...in this array of REGFILTER*
  127.           [out] ULONG * pcFetched         // actual count passed returned here
  128.         );
  129.  
  130.     // I can't think why anyone would want to skip, so it's not implemented.
  131.     // (anyone who thinks they know what they would be skipping over is probably
  132.     // missing some piece of the jigsaw). This ALWAYS returns E_NOTIMPL.
  133.  
  134.     HRESULT Skip(
  135.         [in] ULONG cFilters
  136.     );
  137.  
  138.     HRESULT Reset(void);
  139.  
  140.     // No cloning either - also ALWAYS returns E_NOTIMPL.
  141.  
  142.     HRESULT Clone(
  143.         [out] IEnumRegFilters **ppEnum
  144.     );
  145. }
  146.  
  147.  
  148. typedef IEnumRegFilters *PENUMREGFILTERS;
  149.  
  150. //========================================================================
  151. //========================================================================
  152. // abstraction representing the registered information about filters.
  153. // This allows properties of filters to be looked up without loading them.
  154. //========================================================================
  155. //========================================================================
  156.  
  157. [
  158. object,
  159. uuid(56a868a3-0ad4-11ce-b03a-0020af0ba770),
  160. pointer_default(unique)
  161. ]
  162. interface IFilterMapper : IUnknown {
  163.     import "unknwn.idl";
  164.  
  165.     //==========================================================================
  166.     // Registration functions.
  167.     // A filter should be registered before any other use.
  168.     // The registration can be NON_VOLATILE (i.e. permanent, do once ever)
  169.     // or VOLATILE (once per boot of the system).
  170.     // UnregisterFilter (obviously) removes the registration.
  171.     // The action of any of the other calls on unregistered filters is undefined.
  172.     // it will either work or you'll get an error, but I'm not saying which.
  173.     //==========================================================================
  174.  
  175.     // Four predefined values controling the order in which filters are tried
  176.     // for intelligent graph building.  Intermediate values are legal.
  177.     // Any value <=MERIT_DO_NOT_USE will mean that the filter will never
  178.     // be tried by the filtergrah to automatically complete a connection.
  179.  
  180.     enum { MERIT_PREFERRED     = 0x800000,
  181.            MERIT_NORMAL        = 0x600000,
  182.            MERIT_UNLIKELY      = 0x400000,
  183.            MERIT_DO_NOT_USE    = 0x200000,
  184.            MERIT_SW_COMPRESSOR = 0x100000,
  185.            MERIT_HW_COMPRESSOR = 0x100050
  186.          };
  187.  
  188.     // Register a filter
  189.  
  190.     HRESULT RegisterFilter
  191.         ( [in] CLSID   clsid,    // GUID of the filter
  192.           [in] LPCWSTR Name,     // Descriptive name for the filter
  193.           [in] DWORD   dwMerit   // DO_NOT_USE, UNLIKELY, NORMAL or PREFERRED.
  194.         );
  195.  
  196.  
  197.     // Register an identifiable instance of a filter.  This deals with cases
  198.     // such as two similar sound cards which are driven by the same driver,
  199.     // but we want to choose which oif these cards the sound will come out of.
  200.     // This is not needed if there is only one instance of the filter
  201.     // (e.g. there is only one sound card in the machine) or if all instances
  202.     // of the filter are equivalent.
  203.  
  204.     // The filter itself must have already been registered   // ??? Is that true?
  205.     HRESULT RegisterFilterInstance
  206.         ( [in]  CLSID  clsid,      // GUID of the filter
  207.           [in]  LPCWSTR Name,      // Descriptive name of instance.
  208.           [out] CLSID *MRId        // Returned Media Resource Id.  A
  209.                                    // locally unique id for this instance
  210.                                    // of this filter
  211.         );
  212.  
  213.  
  214.     HRESULT RegisterPin
  215.         ( [in] CLSID   Filter,           // GUID of filter
  216.           [in] LPCWSTR Name,             // Name of the pin
  217.           [in] BOOL    bRendered,        // The filter renders this input
  218.           [in] BOOL    bOutput,          // TRUE if this is an Output pin
  219.           [in] BOOL    bZero,            // TRUE if OK for zero instances of pin
  220.                                          // In this case you will have to Create
  221.                                          // a pin to have even one instance
  222.           [in] BOOL    bMany,            // TRUE if OK for many instances of pin
  223.           [in] CLSID   ConnectsToFilter, // Filter it connects to if it has
  224.                                          // subterranean connection, else NULL
  225.           [in] LPCWSTR ConnectsToPin     // Name of pin it connects to
  226.                                          // NULL for output pins
  227.         );
  228.  
  229.     HRESULT RegisterPinType
  230.         ( [in] CLSID   clsFilter,        // GUID of filter
  231.           [in] LPCWSTR strName,          // Descriptive name of the pin
  232.           [in] CLSID   clsMajorType,     // Major type of the data stream
  233.           [in] CLSID   clsSubType        // Sub type of the data stream
  234.         );
  235.  
  236.  
  237.     HRESULT UnregisterFilter
  238.         ( [in] CLSID  Filter             // GUID of filter
  239.         );
  240.  
  241.  
  242.     HRESULT UnregisterFilterInstance
  243.         ( [in] CLSID  MRId               // Media Resource Id of this instance
  244.         );
  245.  
  246.  
  247.     HRESULT UnregisterPin
  248.         ( [in] CLSID   Filter,           // GUID of filter
  249.           [in] LPCWSTR Name              // Name of the pin
  250.         );
  251.  
  252.  
  253.     // Set *ppEnum to be an enumerator for filters matching the requirements.
  254.  
  255.     HRESULT EnumMatchingFilters
  256.        ( [out] IEnumRegFilters **ppEnum  // enumerator returned
  257.        , [in]  DWORD dwMerit             // at least this merit needed
  258.        , [in]  BOOL  bInputNeeded        // need at least one input pin
  259.        , [in]  CLSID clsInMaj            // input major type
  260.        , [in]  CLSID clsInSub            // input sub type
  261.        , [in]  BOOL  bRender             // must the input be rendered?
  262.        , [in]  BOOL  bOututNeeded        // need at least one output pin
  263.        , [in]  CLSID clsOutMaj           // output major type
  264.        , [in]  CLSID clsOutSub           // output sub type
  265.        );
  266.  
  267. }
  268.  
  269. // structure used to identify media types a pin handles. Used for
  270. // registration through IFilterMapper and IFilterMapper2
  271. //
  272. typedef struct
  273. {
  274.     const CLSID * clsMajorType;
  275.     const CLSID * clsMinorType;
  276. } REGPINTYPES;
  277.  
  278. // describes pin for filter registration. Used for registration
  279. // through IFilterMapper and IFilterMapper2
  280. //
  281. typedef struct
  282. {
  283.     LPWSTR           strName;
  284.  
  285.     // The filter renders this input
  286.     BOOL             bRendered;
  287.  
  288.     // This is an Output pin
  289.     BOOL             bOutput;
  290.  
  291.     // OK to have zero instances of pin In this case you will have to
  292.     // Create a pin to have even one instance
  293.     BOOL             bZero;
  294.  
  295.     // OK to create many instance of  pin
  296.     BOOL             bMany;
  297.  
  298.     const CLSID *    clsConnectsToFilter;
  299.     const WCHAR *    strConnectsToPin;
  300.  
  301.     UINT             nMediaTypes;
  302.     const REGPINTYPES * lpMediaType;
  303. } REGFILTERPINS;
  304.  
  305. // mediums (as defined in the Windows NT DDK) for registration with
  306. // IFilterMapper2
  307. //
  308. typedef struct
  309. {
  310.     CLSID clsMedium;
  311.     DWORD dw1;
  312.     DWORD dw2;
  313. } REGPINMEDIUM;
  314.  
  315. // flags for dwFlags in REFILTERPINS2
  316. enum
  317. {
  318.     // OK to have zero instances of pin In this case you will have to
  319.     // Create a pin to have even one instance
  320.     REG_PINFLAG_B_ZERO = 0x1,
  321.  
  322.     // The filter renders this input
  323.     REG_PINFLAG_B_RENDERER = 0x2,
  324.  
  325.     // OK to create many instance of  pin
  326.     REG_PINFLAG_B_MANY = 0x4,
  327.  
  328.     // This is an Output pin
  329.     REG_PINFLAG_B_OUTPUT = 0x8
  330. };
  331.  
  332.  
  333. // describes pin for filter registration through IFilterMapper2
  334. typedef struct
  335. {
  336.     // combination of REG_PINFLAG flags
  337.     DWORD dwFlags;
  338.  
  339.     // number of instances of the pin if known
  340.     UINT             cInstances;
  341.  
  342.     UINT             nMediaTypes;
  343.     [size_is(nMediaTypes)] const REGPINTYPES * lpMediaType;
  344.  
  345.     UINT             nMediums;
  346.     [size_is(nMediums)] const REGPINMEDIUM *lpMedium;
  347.  
  348.     // pin category (for Kernel Streaming pins) as defined in the
  349.     // Windows NT DDK
  350.     const CLSID      *clsPinCategory;
  351.  
  352. } REGFILTERPINS2;
  353.  
  354. // describes filter for registration through IFilterMapper2
  355. typedef struct
  356. {
  357.     DWORD dwVersion;            // 1 or 2
  358.     DWORD dwMerit;
  359.  
  360.     /* unnamed union */
  361.     [switch_is(dwVersion)] [switch_type(DWORD)] union
  362.     {
  363.         [case(1)]
  364.  
  365.             struct
  366.             {
  367.                 ULONG cPins;
  368.                 [size_is(cPins)] const REGFILTERPINS *rgPins;
  369.             };
  370.  
  371.         [case(2)]
  372.  
  373.             struct
  374.             {
  375.                 ULONG cPins2;
  376.                 [size_is(cPins2)] const REGFILTERPINS2 *rgPins2;
  377.             };
  378.  
  379.         [default]
  380.             ;
  381.     } ;
  382.  
  383. } REGFILTER2;
  384.  
  385.  
  386.  
  387. [
  388. object,
  389. uuid(b79bb0b0-33c1-11d1-abe1-00a0c905f375),
  390. pointer_default(unique)
  391. ]
  392. interface IFilterMapper2 : IUnknown {
  393.     import "unknwn.idl";
  394.  
  395.     // create or rename ActiveMovie category
  396.     HRESULT CreateCategory
  397.         ( [in] REFCLSID clsidCategory,
  398.           [in] DWORD dwCategoryMerit,
  399.           [in] LPCWSTR Description
  400.           );
  401.  
  402.     HRESULT UnregisterFilter
  403.         ( [in] const CLSID *pclsidCategory,
  404.           [in] const OLECHAR *szInstance,
  405.           [in] REFCLSID Filter // GUID of filter
  406.         );
  407.  
  408.     // Register a filter, pins, and media types under a category.
  409.     HRESULT RegisterFilter
  410.         ( [in] REFCLSID clsidFilter,     // GUID of the filter
  411.           [in] LPCWSTR Name,             // Descriptive name for the filter
  412.  
  413.           // ppMoniker can be null. or *ppMoniker can contain the
  414.           // moniker where this filter data will be written;
  415.           // *ppMoniker will be set to null on return. or *ppMoniker
  416.           // can be null in which case the moniker will be returned
  417.           // with refcount.
  418.           [in, out] IMoniker **ppMoniker,
  419.  
  420.           // can be null
  421.           [in] const CLSID *pclsidCategory,
  422.  
  423.           // cannot be null
  424.           [in] const OLECHAR *szInstance,
  425.  
  426.           // rest of filter and pin registration
  427.           [in] const REGFILTER2 *prf2
  428.         );
  429.  
  430.     // Set *ppEnum to be an enumerator for filters matching the
  431.     // requirements.
  432.     HRESULT EnumMatchingFilters
  433.        ( [out] IEnumMoniker **ppEnum           // enumerator returned
  434.        , [in]  DWORD dwFlags                   // 0
  435.        , [in]  BOOL bExactMatch                // don't match wildcards
  436.        , [in]  DWORD dwMerit                   // at least this merit needed
  437.        , [in]  BOOL  bInputNeeded              // need at least one input pin
  438.        , [in]  DWORD cInputTypes               // Number of input types to match
  439.                                                // Any match is OK
  440.        , [size_is(cInputTypes*2)]  const GUID *pInputTypes // input major+subtype pair array
  441.        , [in]  const REGPINMEDIUM *pMedIn      // input medium
  442.        , [in]  const CLSID *pPinCategoryIn     // input pin category
  443.        , [in]  BOOL  bRender                   // must the input be rendered?
  444.        , [in]  BOOL  bOutputNeeded             // need at least one output pin
  445.        , [in]  DWORD cOutputTypes              // Number of output types to match
  446.                                                // Any match is OK
  447.        , [size_is(cOutputTypes*2)]  const GUID *pOutputTypes // output major+subtype pair array
  448.        , [in]  const REGPINMEDIUM *pMedOut     // output medium
  449.        , [in]  const CLSID *pPinCategoryOut    // output pin category
  450.        );
  451. }
  452.  
  453. [
  454. object,
  455. uuid(b79bb0b1-33c1-11d1-abe1-00a0c905f375),
  456. pointer_default(unique)
  457. ]
  458. interface IFilterMapper3 : IFilterMapper2 {
  459.     // new interface to allow creating filters using the mapper's devenum instance
  460.     // primarily needed for out-of-proc access to a graph
  461.     HRESULT GetICreateDevEnum( [out] ICreateDevEnum **ppEnum );
  462. }
  463.  
  464. //========================================================================
  465. //========================================================================
  466. // Defines IQualityControl interface
  467. //
  468. // Defines quality messages and allows a quality manager to install itself
  469. // as the sink for quality messages.
  470. //========================================================================
  471. //========================================================================
  472.  
  473. typedef enum tagQualityMessageType {
  474.     Famine,
  475.     Flood
  476. } QualityMessageType;
  477.  
  478. typedef struct tagQuality {
  479.     QualityMessageType Type;
  480.     long                Proportion;   // milli-units.  1000 = no change
  481.                             // for Flood:
  482.                             // What proportion of the media samples currently
  483.                             // coming through are required in the future.
  484.                             // 800 means please drop another 20%
  485.                             // For Famine:
  486.                             // How much to "keep in" e.g. 800 means send me
  487.                             // 20% less e.g. by dropping 20% of the samples.
  488.                             // 1100 would mean "I'm coping, send me more".
  489.     REFERENCE_TIME       Late;
  490.                             // How much you need to catch up by
  491.     REFERENCE_TIME       TimeStamp;
  492.                             // The stream time when this was generated (probably
  493.                             // corresponds to the start time on some sample).
  494. } Quality;
  495.  
  496. typedef IQualityControl *PQUALITYCONTROL;
  497.  
  498.  
  499. [
  500. object,
  501. uuid(56a868a5-0ad4-11ce-b03a-0020af0ba770),
  502. pointer_default(unique)
  503. ]
  504. interface IQualityControl : IUnknown {
  505.  
  506.     // Notify the recipient that a quality change is requested.
  507.     // pSelf is the IBaseFilter* of the sender.
  508.     // this is sent from a filter
  509.     // to (the quality manager or) an upstream peer.
  510.     HRESULT Notify
  511.         ( [in] IBaseFilter * pSelf,
  512.           [in] Quality q
  513.         );
  514.  
  515.     // Notify the recipient that future quality messages are to be sent
  516.     // to iqc.  If piqc is NULL then quality messages are to default back to
  517.     // the upstream peer.
  518.     // This is sent from the quality manager to a filter.
  519.     // The recipient should hold piqc as a WEAK reference,
  520.     // i.e. do not AddRef it, do not Release it.
  521.     HRESULT SetSink
  522.         ( [in] IQualityControl * piqc
  523.         );
  524. }
  525.  
  526. //=====================================================================
  527. //=====================================================================
  528. // Definitions required for overlay transport
  529. //=====================================================================
  530. //=====================================================================
  531.  
  532.  
  533. // Used to communicate the colour that the IOverlay client wants the window
  534. // painted in so that it can draw directly to the correct clipping region
  535. // A colour key can be described in two alternate ways, the first is by a
  536. // range of one or more (system) palette indices. The second is by defining
  537. // a colour cube with two RGB values, any of which would be acceptable.
  538. //
  539. // The CK values are consistent with GDI PALETTEINDEX and PALETTERGB macros
  540.  
  541.  
  542. enum { CK_NOCOLORKEY = 0x0,     // No color key is required
  543.        CK_INDEX       = 0x1,    // Index into the current system palette
  544.        CK_RGB         = 0x2 };  // Color key is an RGB value (or range)
  545.  
  546. typedef struct tagCOLORKEY {
  547.  
  548.     DWORD    KeyType;           // Explains meaning of the structure
  549.     DWORD    PaletteIndex;      // Palette index if available
  550.     COLORREF LowColorValue;     // Low colour space RGB value
  551.     COLORREF HighColorValue;    // Defines the high RGB value
  552.  
  553. } COLORKEY;
  554.  
  555. // When a filter sets up an advise link it can ask that only certain types
  556. // of notifications be sent, for example just palette changes. While this
  557. // doesn't mean that the other notification call backs won't ever be called
  558. // the IOverlay implementation may use this as an efficiency optimisation
  559.  
  560. enum { ADVISE_NONE = 0x0,               // No notifications required
  561.        ADVISE_CLIPPING = 0x1,           // Synchronous clip information
  562.        ADVISE_PALETTE = 0x2,            // Palette change notifications
  563.        ADVISE_COLORKEY = 0x4,           // Called when colour key changes
  564.        ADVISE_POSITION = 0x8,           // Likewise when window moves etc
  565.        ADVISE_DISPLAY_CHANGE = 0x10     // Called on WM_DISPLAYCHANGE
  566.      };
  567.  
  568. const DWORD ADVISE_ALL = ADVISE_CLIPPING |
  569.                          ADVISE_PALETTE |
  570.                          ADVISE_COLORKEY |
  571.                          ADVISE_POSITION;
  572.  
  573. const DWORD ADVISE_ALL2 = ADVISE_ALL |
  574.                           ADVISE_DISPLAY_CHANGE;
  575.  
  576. // This isn't defined when you run IDL
  577.  
  578. cpp_quote("#ifndef _WINGDI_")
  579.  
  580. typedef struct _RGNDATAHEADER {
  581.     DWORD dwSize;
  582.     DWORD iType;
  583.     DWORD nCount;
  584.     DWORD nRgnSize;
  585.     RECT  rcBound;
  586. } RGNDATAHEADER;
  587.  
  588. typedef struct _RGNDATA {
  589.     RGNDATAHEADER rdh;
  590.     char Buffer[1];
  591. } RGNDATA;
  592.  
  593. cpp_quote("#endif")
  594.  
  595.  
  596. //=====================================================================
  597. //=====================================================================
  598. // Defines IOverlayNotify interface
  599. //
  600. // This interface gives asynchronous notifications of changes to the
  601. // rendering window - such as changes to the exposed window area
  602. //=====================================================================
  603. //=====================================================================
  604.  
  605. [
  606. object,
  607. local,
  608. uuid(56a868a0-0ad4-11ce-b03a-0020af0ba770),
  609. pointer_default(unique)
  610. ]
  611. interface IOverlayNotify : IUnknown {
  612.  
  613.     // IOverlayNotify methods
  614.  
  615.     // This notifies the filter of palette changes, the filter should copy
  616.     // the array of RGBQUADs if it needs to use them after returning. This
  617.     // is not called when the palette is actually changed in the display
  618.     // but at a short time after (in sync with WM_PALETTECHANGED messages)
  619.  
  620.     HRESULT OnPaletteChange(
  621.         [in] DWORD dwColors,                // Number of colours present
  622.         [in] const PALETTEENTRY *pPalette); // Array of palette colours
  623.  
  624.     // This provides synchronous clip changes so that the client is called
  625.     // before the window is moved to freeze the video, and then when the
  626.     // window has stabilised it is called again to start playback again.
  627.     // If the window rect is all zero then the window is invisible, the
  628.     // filter must take a copy of the information if it wants to keep it
  629.  
  630.     HRESULT OnClipChange(
  631.         [in] const RECT *pSourceRect,       // Region of video to use
  632.         [in] const RECT *pDestinationRect,  // Where video goes
  633.         [in] const RGNDATA *pRgnData);      // Defines clipping information
  634.  
  635.     HRESULT OnColorKeyChange([in] const COLORKEY *pColorKey);
  636.  
  637.     // The calls to OnClipChange happen in sync with the window. So it is
  638.     // called with an empty clip list before the window moves to freeze
  639.     // the video, and then when the window has stabilised it is called
  640.     // again with the new clip list. The OnPositionChange callback is for
  641.     // overlay cards that don't want the expense of synchronous clipping
  642.     // updates and just want to know when the source or destination video
  643.     // positions change. They will NOT be called in sync with the window
  644.     // but at some point after the window has changed (basicly in time
  645.     // with WM_SIZE etc messages received). This is therefore suitable
  646.     // for overlay cards that don't inlay their data to the frame buffer
  647.     // NOTE the destination is NOT clipped to the visible display area
  648.  
  649.     HRESULT OnPositionChange([in] const RECT *pSourceRect,
  650.                              [in] const RECT *pDestinationRect);
  651. }
  652.  
  653. typedef IOverlayNotify *POVERLAYNOTIFY;
  654.  
  655.  
  656. //=====================================================================
  657. //=====================================================================
  658. // Defines IOverlayNotify2 interface
  659. //
  660. // This interface gives asynchronous notifications of changes to the
  661. // rendering window - such as changes to the exposed window area
  662. // This is optionally supported by the advise sink for the purposes
  663. // of accepting OnDisplayChange notification.
  664. //=====================================================================
  665. //=====================================================================
  666.  
  667. cpp_quote("#if !defined(HMONITOR_DECLARED) && !defined(HMONITOR) && (WINVER < 0x0500)")
  668. cpp_quote("#define HMONITOR_DECLARED")
  669. cpp_quote("#if 0")
  670. typedef HANDLE HMONITOR;
  671. cpp_quote("#endif")
  672. cpp_quote("DECLARE_HANDLE(HMONITOR);")
  673. cpp_quote("#endif")
  674.  
  675. [
  676. object,
  677. local,
  678. uuid(680EFA10-D535-11D1-87C8-00A0C9223196),
  679. pointer_default(unique)
  680. ]
  681. interface IOverlayNotify2 : IOverlayNotify {
  682.  
  683.     // IOverlayNotify2 methods
  684.  
  685.     HRESULT OnDisplayChange(    // ADVISE_DISPLAY_CHANGE
  686.         HMONITOR hMonitor);
  687. }
  688.  
  689. typedef IOverlayNotify2 *POVERLAYNOTIFY2;
  690.  
  691.  
  692. //=====================================================================
  693. //=====================================================================
  694. // Defines IOverlay interface
  695. //
  696. // This interface provides information so that a filter can write direct to
  697. // the frame buffer while placing the video in the correct window position
  698. //=====================================================================
  699. //=====================================================================
  700.  
  701. [
  702. object,
  703. local,
  704. uuid(56a868a1-0ad4-11ce-b03a-0020af0ba770),
  705. pointer_default(unique)
  706. ]
  707. interface IOverlay : IUnknown {
  708.  
  709.     // IOverlay methods
  710.  
  711.     HRESULT GetPalette(
  712.         [out] DWORD *pdwColors,              // Number of colours present
  713.         [out] PALETTEENTRY **ppPalette);     // Where to put palette data
  714.  
  715.     HRESULT SetPalette(
  716.         [in] DWORD dwColors,                 // Number of colours present
  717.         [in] PALETTEENTRY *pPalette);        // Colours to use for palette
  718.  
  719.     // If you change the colour key through SetColorKey then all the advise
  720.     // links will receive an OnColorKeyChange callback with the new colour
  721.  
  722.     HRESULT GetDefaultColorKey([out] COLORKEY *pColorKey);
  723.     HRESULT GetColorKey([out] COLORKEY *pColorKey);
  724.     HRESULT SetColorKey([in,out] COLORKEY *pColorKey);
  725.     HRESULT GetWindowHandle([out] HWND *pHwnd);
  726.  
  727.     // The IOverlay implementation allocates the memory for the clipping
  728.     // rectangles as it can be variable in length. The filter calling
  729.     // this method should free the memory when it is finished with it
  730.  
  731.     HRESULT GetClipList([out] RECT *pSourceRect,
  732.                         [out] RECT *pDestinationRect,
  733.                         [out] RGNDATA **ppRgnData);
  734.  
  735.     // Returns the current video source and destination
  736.  
  737.     HRESULT GetVideoPosition([out] RECT *pSourceRect,
  738.                              [out] RECT *pDestinationRect);
  739.  
  740.     HRESULT Advise(
  741.         [in] IOverlayNotify *pOverlayNotify, // Notification interface
  742.         [in] DWORD dwInterests);             // Callbacks interested in
  743.  
  744.     HRESULT Unadvise();                      // Stop the callbacks now
  745. }
  746.  
  747. typedef IOverlay *POVERLAY;
  748.  
  749.  
  750. //=====================================================================
  751. //=====================================================================
  752. // control related interfaces (others are defined in control.odl)
  753. //=====================================================================
  754. //=====================================================================
  755.  
  756.  
  757. //=====================================================================
  758. //=====================================================================
  759. // Defines IMediaEventSink interface
  760. //
  761. // Exposed by filtergraph. Called by filters to notify events. Will be
  762. // passed on to application by the IMediaControl event methods.
  763. //=====================================================================
  764. //=====================================================================
  765.  
  766. [
  767.         object,
  768.         uuid(56a868a2-0ad4-11ce-b03a-0020af0ba770),
  769.         pointer_default(unique)
  770. ]
  771. interface IMediaEventSink : IUnknown {
  772.  
  773.     // notify an event. will be queued, but not delivered to
  774.     // the application on this thread.
  775.     HRESULT Notify(
  776.         [in] long EventCode,
  777.         [in] LONG_PTR EventParam1,
  778.         [in] LONG_PTR EventParam2
  779.     );
  780. }
  781.  
  782. typedef IMediaEventSink *PMEDIAEVENTSINK;
  783.  
  784. //=====================================================================
  785. //=====================================================================
  786. // Defines IFileSourceFilter interface
  787. //
  788. // Exposed by source filters to set the file name and media type.
  789. //=====================================================================
  790. //=====================================================================
  791.  
  792. [
  793.         object,
  794.         uuid(56a868a6-0ad4-11ce-b03a-0020af0ba770),
  795.         pointer_default(unique)
  796. ]
  797. interface IFileSourceFilter : IUnknown {
  798.  
  799.     // Load a file and assign it the given media type
  800.     HRESULT Load(
  801.         [in] LPCOLESTR pszFileName,     // Pointer to absolute path of file to open
  802.         [in, unique] const AM_MEDIA_TYPE *pmt   // Media type of file - can be NULL
  803.     );
  804.     // Get the currently loaded file name
  805.     HRESULT GetCurFile(
  806.         [out] LPOLESTR *ppszFileName,   // Pointer to the path for the current file
  807.         [out] AM_MEDIA_TYPE *pmt        // Pointer to the media type
  808.     );
  809. }
  810.  
  811. typedef IFileSourceFilter *PFILTERFILESOURCE;
  812.  
  813. //=====================================================================
  814. //=====================================================================
  815. // Defines IFileSinkFilter interface
  816. //
  817. // Exposed by renderers to set the output file name.
  818. //=====================================================================
  819. //=====================================================================
  820.  
  821. [
  822.         object,
  823.         uuid(a2104830-7c70-11cf-8bce-00aa00a3f1a6),
  824.         pointer_default(unique)
  825. ]
  826. interface IFileSinkFilter : IUnknown {
  827.  
  828.     // Output to this file. default is to open the existing file
  829.     HRESULT SetFileName(
  830.         [in] LPCOLESTR pszFileName,     // Pointer to absolute path of output file
  831.         [in, unique] const AM_MEDIA_TYPE *pmt   // Media type of file - can be NULL
  832.     );
  833.     // Get the current file name
  834.     HRESULT GetCurFile(
  835.         [out] LPOLESTR *ppszFileName,   // Pointer to the path for the current file
  836.         [out] AM_MEDIA_TYPE *pmt        // Pointer to the media type
  837.     );
  838. }
  839.  
  840. typedef IFileSinkFilter *PFILTERFILESINK;
  841.  
  842. [
  843.         object,
  844.         uuid(00855B90-CE1B-11d0-BD4F-00A0C911CE86),
  845.         pointer_default(unique)
  846. ]
  847. interface IFileSinkFilter2 : IFileSinkFilter {
  848.  
  849.     HRESULT SetMode(
  850.         [in] DWORD dwFlags              // AM_FILESINK_FLAGS
  851.     );
  852.  
  853.     HRESULT GetMode(
  854.         [out] DWORD *pdwFlags           // AM_FILESINK_FLAGS
  855.     );
  856. }
  857.  
  858. typedef IFileSinkFilter2 *PFILESINKFILTER2;
  859.  
  860. typedef enum {
  861.  
  862.     // create a new file
  863.     AM_FILE_OVERWRITE = 0x00000001,
  864.  
  865. } AM_FILESINK_FLAGS;
  866.  
  867.  
  868. //
  869. // Intelligent connectivity for filters - an interface supported by
  870. // filter graphs (since it is an extension to IFilterGraph) that supports
  871. // building of graphs by automatic selection and connection of appropriate
  872. // filters
  873.  
  874. [
  875.     object,
  876.     uuid(56a868a9-0ad4-11ce-b03a-0020af0ba770),
  877.     pointer_default(unique)
  878. ]
  879. interface IGraphBuilder : IFilterGraph {
  880.     // Connect these two pins directly or indirectly, using transform filters
  881.     // if necessary.
  882.  
  883.     HRESULT Connect
  884.         ( [in] IPin * ppinOut,    // the output pin
  885.           [in] IPin * ppinIn      // the input pin
  886.         );
  887.  
  888.  
  889.     // Connect this output pin directly or indirectly, using transform filters
  890.     // if necessary to something that will render it.
  891.  
  892.     HRESULT Render
  893.         ( [in] IPin * ppinOut     // the output pin
  894.         );
  895.  
  896.  
  897.     // Build a filter graph that will render this file using this play list.
  898.     // If lpwstrPlayList is NULL then it will use the default play list
  899.     // which will typically render the whole file.
  900.  
  901.     HRESULT RenderFile
  902.         ( [in] LPCWSTR lpcwstrFile,
  903.           [in, unique] LPCWSTR lpcwstrPlayList
  904.         );
  905.  
  906.  
  907.     // Add to the filter graph a source filter for this file.  This would
  908.     // be the same source filter that would be added by calling Render.
  909.     // This call gives you more control over building
  910.     // the rest of the graph, e.g. AddFilter(<a renderer of your choice>)
  911.     // and then Connect the two.
  912.     // The IBaseFilter* interface exposed by the source filter is returned
  913.     // in ppFilter, addrefed already for you
  914.     // The filter will be known by the name lpcwstrFIlterName
  915.     // nn this filter graph,
  916.     HRESULT AddSourceFilter
  917.         ( [in]      LPCWSTR lpcwstrFileName,
  918.           [in, unique]      LPCWSTR lpcwstrFilterName,
  919.           [out]     IBaseFilter* *ppFilter
  920.         );
  921.  
  922.  
  923.     // If this call is made then trace information will be written to the
  924.     // file showing the actions taken in attempting to perform an operation.
  925.     HRESULT SetLogFile
  926.         ( [in]      DWORD_PTR hFile  // open file handle e.g. from CreateFile
  927.         );
  928.  
  929.  
  930.     // Request that the graph builder should return as soon as possible from
  931.     // its current task.
  932.     // Note that it is possible fot the following to occur in the following
  933.     // sequence:
  934.     //     Operation begins; Abort is requested; Operation completes normally.
  935.     // This would be normal whenever the quickest way to finish an operation
  936.     // was to simply continue to the end.
  937.     HRESULT Abort();
  938.  
  939.     // Return S_OK if the curent operation is to continue,
  940.     // return S_FALSE if the current operation is to be aborted.
  941.     // This method can be called as a callback from a filter which is doing
  942.     // some operation at the request of the graph.
  943.     HRESULT ShouldOperationContinue();
  944.  
  945. }
  946.  
  947.  
  948. //
  949. // New capture graph builder
  950.  
  951. [
  952.     object,
  953.     uuid(bf87b6e0-8c27-11d0-b3f0-00aa003761c5),
  954.     pointer_default(unique)
  955. ]
  956. interface ICaptureGraphBuilder : IUnknown {
  957.  
  958.     // Use this filtergraph
  959.     HRESULT SetFiltergraph(
  960.     [in] IGraphBuilder *pfg);
  961.  
  962.     // what filtergraph are you using?
  963.     // *ppfg->Release() when you're done with it
  964.     HRESULT GetFiltergraph(
  965.     [out] IGraphBuilder **ppfg);
  966.  
  967.     // creates a rendering section in the filtergraph consisting of a MUX
  968.     // of some filetype, and a file writer (and connects them together)
  969.     // *ppf->Release() when you're done with it
  970.     // *ppSink->Release() when you're done with it
  971.     HRESULT SetOutputFileName(
  972.     [in] const GUID *pType, // type of file to write, eg. MEDIASUBTYPE_Avi
  973.     [in] LPCOLESTR lpstrFile,   // filename given to file writer
  974.     [out] IBaseFilter **ppf,    // returns pointer to the MUX
  975.         [out] IFileSinkFilter **ppSink);// queried from file writer
  976.  
  977.     // Looks for an interface on the filter and on the output pin of the given
  978.     // category.  (Categories: CAPTURE/PREVIEW/VIDEOPORT/VBI etc. or
  979.     // NULL for "don't care".
  980.     // It will also look upstream and downstream of
  981.     // the pin for the interface, to find interfaces on renderers, MUXES, TV
  982.     // Tuners, etc.
  983.     // Call *ppint->Release() when you're done with it
  984.     [local] HRESULT FindInterface(
  985.     [in, unique] const GUID *pCategory, // can be NULL for all pins
  986.     [in] IBaseFilter *pf,
  987.     [in] REFIID riid,
  988.     [out] void **ppint);
  989.     [call_as(FindInterface)] HRESULT RemoteFindInterface(
  990.     [in, unique] const GUID *pCategory, // can be NULL for all pins
  991.     [in] IBaseFilter *pf,
  992.     [in] REFIID riid,
  993.     [out] IUnknown **ppint);
  994.  
  995.     // Connects the pin of the given category of the source filter to the
  996.     // rendering filter, optionally through another filter (compressor?)
  997.     // For a non-NULL category, it will instantiate and connect additional
  998.     // required filters upstream too, like TV Tuners and Crossbars.
  999.     // If there is only one output pin on the source, use a NULL
  1000.     // category.  You can also have pSource be a pin
  1001.     HRESULT RenderStream(
  1002.     [in] const GUID *pCategory, // can be NULL if only one output pin
  1003.     [in] IUnknown *pSource,     // filter or pin
  1004.     [in] IBaseFilter *pfCompressor,
  1005.     [in] IBaseFilter *pfRenderer);  // can be NULL
  1006.  
  1007.     // Sends IAMStreamControl messages to the pin of the desired category, eg.
  1008.     // "capture" or "preview"
  1009.     // REFERENCE_TIME=NULL means NOW
  1010.     // REFERENCE_TIME=MAX_TIME means never, or cancel previous request
  1011.     // NULL controls all capture filters in the graph - you will get one
  1012.     //     notification for each filter with a pin of that category found
  1013.     // returns S_FALSE if stop will be signalled before last sample is
  1014.     //     rendered.
  1015.     // return a FAILURE code if the filter does not support IAMStreamControl
  1016.     HRESULT ControlStream(
  1017.     [in] const GUID *pCategory,
  1018.     [in] IBaseFilter *pFilter,
  1019.     [in] REFERENCE_TIME *pstart,
  1020.     [in] REFERENCE_TIME *pstop,
  1021.     [in] WORD wStartCookie,     // high word reserved
  1022.     [in] WORD wStopCookie);     // high word reserved
  1023.  
  1024.     // creates a pre-allocated file of a given size in bytes
  1025.     HRESULT AllocCapFile(
  1026.     [in] LPCOLESTR lpstr,
  1027.     [in] DWORDLONG dwlSize);
  1028.  
  1029.     // Copies the valid file data out of the old, possibly huge old capture
  1030.     //   file into a shorter new file.
  1031.     // Return S_FALSE from your progress function to abort capture, S_OK to
  1032.     //   continue
  1033.     HRESULT CopyCaptureFile(
  1034.     [in] LPOLESTR lpwstrOld,
  1035.     [in] LPOLESTR lpwstrNew,
  1036.     [in] int fAllowEscAbort,    // pressing ESC will abort?
  1037.     [in] IAMCopyCaptureFileProgress *pCallback);    // implement this to
  1038.                                 // get progress
  1039. }
  1040.  
  1041.  
  1042. //
  1043. // Capture graph builder "CopyCapturedFile" progress callback
  1044.  
  1045. [
  1046.     object,
  1047.     uuid(670d1d20-a068-11d0-b3f0-00aa003761c5),
  1048.     pointer_default(unique)
  1049. ]
  1050. interface IAMCopyCaptureFileProgress : IUnknown {
  1051.  
  1052.     // If you support this interface somewhere, this function will be called
  1053.     // periodically while ICaptureGraphBuilder::CopyCaptureFile is executing
  1054.     // to let you know the progress
  1055.     //
  1056.     // Return S_OK from this function to continue.  Return S_FALSE to abort the
  1057.     // copy
  1058.     HRESULT Progress(
  1059.     [in] int iProgress);        // a number between 0 and 100 (%)
  1060. }
  1061.  
  1062.  
  1063. //
  1064. // Capture graph builder that can deal with a single filter having more than
  1065. // one pin of each category... some new devices can capture both audio and
  1066. // video, for example
  1067. //
  1068.  
  1069. [
  1070.     object,
  1071.     uuid(93E5A4E0-2D50-11d2-ABFA-00A0C9C6E38D),
  1072.     pointer_default(unique)
  1073. ]
  1074. interface ICaptureGraphBuilder2 : IUnknown {
  1075.  
  1076.     // Use this filtergraph
  1077.     HRESULT SetFiltergraph(
  1078.     [in] IGraphBuilder *pfg);
  1079.  
  1080.     // what filtergraph are you using?
  1081.     // *ppfg->Release() when you're done with it
  1082.     HRESULT GetFiltergraph(
  1083.     [out] IGraphBuilder **ppfg);
  1084.  
  1085.     // creates a rendering section in the filtergraph consisting of a MUX
  1086.     // of some filetype, and a file writer (and connects them together)
  1087.     // *ppf->Release() when you're done with it
  1088.     // *ppSink->Release() when you're done with it
  1089.     HRESULT SetOutputFileName(
  1090.     [in] const GUID *pType,     // GUID of MUX filter to use
  1091.     [in] LPCOLESTR lpstrFile,   // filename given to file writer
  1092.     [out] IBaseFilter **ppf,    // returns pointer to the MUX
  1093.         [out] IFileSinkFilter **ppSink);// queried from file writer
  1094.  
  1095.     // Looks for an interface on the filter and on the output pin of the given
  1096.     // category and type.  (Categories: CAPTURE/PREVIEW/VIDEOPORT/VBI etc. or
  1097.     // NULL for "don't care".  Type:  MAJORTYPE_Video/Audio etc or NULL)
  1098.     // !!! Will some filters have >1 capture pin?  ie RGB and MPEG?
  1099.     // It will also look upstream and downstream of
  1100.     // the pin for the interface, to find interfaces on renderers, MUXES, TV
  1101.     // Tuners, etc.
  1102.     // Call *ppint->Release() when you're done with it
  1103.     [local] HRESULT FindInterface(
  1104.     [in] const GUID *pCategory, // can be NULL for all pins
  1105.     [in] const GUID *pType,     // Audio/Video/??? or NULL (don't care)
  1106.     [in] IBaseFilter *pf,
  1107.     [in] REFIID riid,
  1108.     [out] void **ppint);
  1109.     [call_as(FindInterface)] HRESULT RemoteFindInterface(
  1110.     [in] const GUID *pCategory, // can be NULL for all pins
  1111.     [in] const GUID *pType,     // Audio/Video/??? or NULL (don't care)
  1112.     [in] IBaseFilter *pf,
  1113.     [in] REFIID riid,
  1114.     [out] IUnknown **ppint);
  1115.  
  1116.     // Connects the pin of the given category and type of the source filter to
  1117.     // the rendering filter, optionally through another filter (compressor?)
  1118.     // (Type is a Majortype, like Video or Audio)
  1119.     // For a non-NULL category, it will instantiate and connect additional
  1120.     // required filters upstream too, like TV Tuners and Crossbars.
  1121.     // If there is only one output pin on the source, use a NULL category
  1122.     // and type.  You can also have pSource be a pin
  1123.     HRESULT RenderStream(
  1124.     [in] const GUID *pCategory, // can be NULL if only one output pin
  1125.     [in] const GUID *pType,     // Major type (Video/Audio/etc)
  1126.     [in] IUnknown *pSource,     // filter or pin
  1127.     [in] IBaseFilter *pfCompressor,
  1128.     [in] IBaseFilter *pfRenderer);  // can be NULL
  1129.  
  1130.     // Sends IAMStreamControl messages to the pin of the desired category,
  1131.     // (eg. "capture" or "preview") and of the desired type (eg. VIDEO or AUDIO)
  1132.     // A category MUST be given.  If a filter is given, a type must be too.
  1133.     // REFERENCE_TIME=NULL means NOW
  1134.     // REFERENCE_TIME=MAX_TIME means never, or cancel previous request
  1135.     // NULL controls all capture filters in the graph - you will get one
  1136.     //     notification for each filter with a pin of that category found
  1137.     // returns S_FALSE if stop will be signalled before last sample is
  1138.     //     rendered.
  1139.     // return a FAILURE code if the filter does not support IAMStreamControl
  1140.     HRESULT ControlStream(
  1141.     [in] const GUID *pCategory,
  1142.     [in] const GUID *pType,     // Major type (Video/Audio/etc)
  1143.     [in] IBaseFilter *pFilter,
  1144.     [in] REFERENCE_TIME *pstart,
  1145.     [in] REFERENCE_TIME *pstop,
  1146.     [in] WORD wStartCookie,     // high word reserved
  1147.     [in] WORD wStopCookie);     // high word reserved
  1148.  
  1149.     // creates a pre-allocated file of a given size in bytes
  1150.     HRESULT AllocCapFile(
  1151.     [in] LPCOLESTR lpstr,
  1152.     [in] DWORDLONG dwlSize);
  1153.  
  1154.     // Copies the valid file data out of the old, possibly huge old capture
  1155.     //   file into a shorter new file.
  1156.     // Return S_FALSE from your progress function to abort capture, S_OK to
  1157.     //   continue
  1158.     HRESULT CopyCaptureFile(
  1159.     [in] LPOLESTR lpwstrOld,
  1160.     [in] LPOLESTR lpwstrNew,
  1161.     [in] int fAllowEscAbort,    // pressing ESC will abort?
  1162.     [in] IAMCopyCaptureFileProgress *pCallback);    // implement this to
  1163.                                 // get progress
  1164.     // Helper fn to find a certain pin on a filter.
  1165.     HRESULT FindPin(
  1166.     [in] IUnknown *pSource,
  1167.     [in] PIN_DIRECTION pindir,  // input or output?
  1168.     [in] const GUID *pCategory, // what category? (or NULL)
  1169.     [in] const GUID *pType,     // what Major type (or NULL)
  1170.     [in] BOOL fUnconnected,     // must it be unconnected?
  1171.     [in] int num,           // which pin matching this? (0 based)
  1172.     [out] IPin **ppPin);
  1173. }
  1174.  
  1175. enum _AM_RENSDEREXFLAGS {
  1176.     AM_RENDEREX_RENDERTOEXISTINGRENDERERS = 0x01 // Dont add any renderers
  1177. };
  1178.  
  1179. //
  1180. // IFilterGraph2
  1181. //
  1182. // New methods on for IFilterGraph and IGraphBuilder will have to go here.
  1183. //
  1184.  
  1185. [
  1186.     object,
  1187.     uuid(36b73882-c2c8-11cf-8b46-00805f6cef60),
  1188.     pointer_default(unique)
  1189. ]
  1190. interface IFilterGraph2: IGraphBuilder {
  1191.  
  1192.     // Add a Moniker source moniker
  1193.     HRESULT AddSourceFilterForMoniker(
  1194.           [in] IMoniker *pMoniker,
  1195.           [in] IBindCtx *pCtx,
  1196.           [in, unique] LPCWSTR lpcwstrFilterName,
  1197.           [out] IBaseFilter **ppFilter
  1198.     );
  1199.  
  1200.     // Specify the type for a reconnect
  1201.     // This is better than Reconnect as sometime the parties to a
  1202.     // reconnection can't remember what type they'd agreed (!)
  1203.     HRESULT ReconnectEx
  1204.         ( [in] IPin * ppin,             // the pin to disconnect and reconnect
  1205.           [in, unique] const AM_MEDIA_TYPE *pmt // the type to reconnect with - can be NULL
  1206.         );
  1207.  
  1208.     // Render a pin without adding any new renderers
  1209.     HRESULT RenderEx( [in] IPin *pPinOut,         // Pin to render
  1210.                       [in] DWORD dwFlags,         // flags
  1211.                       [in, out] DWORD *pvContext   // Unused - set to NULL
  1212.                     );
  1213.  
  1214. #if 0
  1215.     // Method looks for a filter which supports the specified interface.  If such
  1216.     // a filter exists, an AddRef()'ed pointer to the requested interface is placed
  1217.     // in *ppInterface.
  1218.     //
  1219.     // *ppInterface will be NULL on return if such a filter could not be found, and
  1220.     // the method will return E_NOINTERFACE.
  1221.     //
  1222.     // pdwIndex is an internal index that is used for obtaining subsequent interfaces.
  1223.     // *pdwIndex should be initialized to zero.  It is set on return to a value that
  1224.     // allows the implementation of FindFilterInterface to search for further interfaces
  1225.     // if called again.  If no more such interfaces exist, the method will return E_NOINTERFACE.
  1226.     //
  1227.     // If pdwIndex is NULL, FindFilterInterface returns an interface only if there is just
  1228.     // a single filter in the graph that supports the interface.  Otherwise it returns
  1229.     // E_NOINTERFACE.
  1230.     //
  1231.     HRESULT FindFilterInterface( [in] REFIID iid, [out] void ** ppInterface, [in,out] LPDWORD pdwIndex );
  1232.  
  1233.     // Tries to obtain the interface from the filter graph itself.  If this fails,
  1234.     // it attempts to find the unique filter that supports the interface.
  1235.     // On failure the method will return E_NOINTERFACE.  On success, it returns
  1236.     // S_OK and an AddRef()'ed pointer to the requested interface in *ppInterface.
  1237.     //
  1238.     HRESULT FindInterface( [in] REFIID iid, [out] void ** ppInterface );
  1239.  
  1240. #endif
  1241. }
  1242.  
  1243. //
  1244. // StreamBuilder
  1245. // aka Graph building with constraints
  1246. // aka convergent graphs
  1247. // aka Closed captioning
  1248.  
  1249. [
  1250.     object,
  1251.     local,
  1252.     uuid(56a868bf-0ad4-11ce-b03a-0020af0ba770),
  1253.     pointer_default(unique)
  1254. ]
  1255. interface IStreamBuilder : IUnknown {
  1256.  
  1257.     // Connect this output pin directly or indirectly, using transform filters
  1258.     // if necessary to thing(s) that will render it, within this graph
  1259.     // Move from Initial state to Rendered state.
  1260.  
  1261.     HRESULT Render
  1262.         ( [in] IPin * ppinOut,         // the output pin
  1263.           [in] IGraphBuilder * pGraph  // the graph
  1264.         );
  1265.  
  1266.     // Undo what you did in Render.  Return to Initial state.
  1267.     HRESULT Backout
  1268.         ( [in] IPin * ppinOut,         // the output pin
  1269.           [in] IGraphBuilder * pGraph  // the graph
  1270.         );
  1271. }
  1272.  
  1273.  
  1274. // async reader interface - supported by file source filters. Allows
  1275. // multiple overlapped reads from different positions
  1276.  
  1277.  
  1278. [
  1279.         object,
  1280.         uuid(56a868aa-0ad4-11ce-b03a-0020af0ba770),
  1281.         pointer_default(unique)
  1282. ]
  1283. interface IAsyncReader : IUnknown
  1284. {
  1285.     // pass in your preferred allocator and your preferred properties.
  1286.     // method returns the actual allocator to be used. Call GetProperties
  1287.     // on returned allocator to learn alignment and prefix etc chosen.
  1288.     // this allocator will be not be committed and decommitted by
  1289.     // the async reader, only by the consumer.
  1290.     // Must call this before calling Request.
  1291.     HRESULT RequestAllocator(
  1292.                 [in]  IMemAllocator* pPreferred,
  1293.                 [in]  ALLOCATOR_PROPERTIES* pProps,
  1294.                 [out] IMemAllocator ** ppActual);
  1295.  
  1296.     // queue a request for data.
  1297.     // media sample start and stop times contain the requested absolute
  1298.     // byte position (start inclusive, stop exclusive).
  1299.     // may fail if sample not obtained from agreed allocator.
  1300.     // may fail if start/stop position does not match agreed alignment.
  1301.     // samples allocated from source pin's allocator may fail
  1302.     // GetPointer until after returning from WaitForNext.
  1303.     // Stop position must be aligned - this means it may exceed duration.
  1304.     // on completion, stop position will be corrected to unaligned
  1305.     // actual data.
  1306.     HRESULT Request(
  1307.                 [in] IMediaSample* pSample,
  1308.                 [in] DWORD_PTR dwUser);         // user context
  1309.  
  1310.     // block until the next sample is completed or the timeout occurs.
  1311.     // timeout (millisecs) may be 0 or INFINITE. Samples may not
  1312.     // be delivered in order. If there is a read error of any sort, a
  1313.     // notification will already have been sent by the source filter,
  1314.     // and HRESULT will be an error.
  1315.     // If ppSample is not null, then a Request completed with the result
  1316.     // code returned.
  1317.     HRESULT WaitForNext(
  1318.                 [in]  DWORD dwTimeout,
  1319.                 [out] IMediaSample** ppSample,  // completed sample
  1320.                 [out] DWORD_PTR * pdwUser);     // user context
  1321.  
  1322.     // sync read of data. Sample passed in must have been acquired from
  1323.     // the agreed allocator. Start and stop position must be aligned.
  1324.     // equivalent to a Request/WaitForNext pair, but may avoid the
  1325.     // need for a thread on the source filter.
  1326.     HRESULT SyncReadAligned(
  1327.                 [in] IMediaSample* pSample);
  1328.  
  1329.  
  1330.     // sync read. works in stopped state as well as run state.
  1331.     // need not be aligned. Will fail if read is beyond actual total
  1332.     // length.
  1333.     HRESULT SyncRead(
  1334.                 [in]  LONGLONG llPosition,  // absolute file position
  1335.                 [in]  LONG lLength,     // nr bytes required
  1336.                 [out, size_is(lLength)]
  1337.               BYTE* pBuffer);       // write data here
  1338.  
  1339.     // return total length of stream, and currently available length.
  1340.     // reads for beyond the available length but within the total length will
  1341.     // normally succeed but may block for a long period.
  1342.     HRESULT Length(
  1343.                 [out] LONGLONG* pTotal,
  1344.                 [out] LONGLONG* pAvailable);
  1345.  
  1346.     // cause all outstanding reads to return, possibly with a failure code
  1347.     //(VFW_E_TIMEOUT) indicating they were cancelled.
  1348.     // Between BeginFlush and EndFlush calls, Request calls will fail and
  1349.     // WaitForNext calls will always complete immediately.
  1350.     HRESULT BeginFlush(void);
  1351.     HRESULT EndFlush(void);
  1352. }
  1353.  
  1354.  
  1355. // interface provided by the filtergraph itself to let other objects
  1356. // (especially plug-in distributors, but also apps like graphedt) know
  1357. // when the graph has changed.
  1358. [
  1359.     object,
  1360.     uuid(56a868ab-0ad4-11ce-b03a-0020af0ba770),
  1361.     pointer_default(unique)
  1362. ]
  1363. interface IGraphVersion : IUnknown
  1364. {
  1365.     // returns the current graph version number
  1366.     // this is incremented every time there is a change in the
  1367.     // set of filters in the graph or in their connections
  1368.     //
  1369.     // if this is changed since your last enumeration, then re-enumerate
  1370.     // the graph
  1371.     HRESULT QueryVersion(LONG* pVersion);
  1372. }
  1373.  
  1374.  
  1375.  
  1376.  
  1377. //
  1378. // interface describing an object that uses resources.
  1379. //
  1380. // implement if: you request resources using IResourceManager. You will
  1381. // need to pass your implementation of this pointer as an in param.
  1382. //
  1383. // use if: you are a resource manager who implements IResourceManager
  1384. [
  1385.     object,
  1386.     uuid(56a868ad-0ad4-11ce-b03a-0020af0ba770),
  1387.     pointer_default(unique)
  1388. ]
  1389. interface IResourceConsumer : IUnknown
  1390. {
  1391.     // you may acquire the resource specified.
  1392.     // return values:
  1393.     //      S_OK    -- I have successfully acquired it
  1394.     //      S_FALSE -- I will acquire it and call NotifyAcquire afterwards
  1395.     //      VFW_S_NOT_NEEDED: I no longer need the resource
  1396.     //      FAILED(hr)-I tried to acquire it and failed.
  1397.  
  1398.     HRESULT
  1399.     AcquireResource(
  1400.         [in] LONG idResource);
  1401.  
  1402.  
  1403.  
  1404.     // Please release the resource.
  1405.     // return values:
  1406.     //      S_OK    -- I have released it (and want it again when available)
  1407.     //      S_FALSE -- I will call NotifyRelease when I have released it
  1408.     //      other   something went wrong.
  1409.     HRESULT
  1410.     ReleaseResource(
  1411.         [in] LONG idResource);
  1412. }
  1413.  
  1414.  
  1415.  
  1416. // interface describing a resource manager that will resolve contention for
  1417. // named resources.
  1418. //
  1419. // implement if: you are a resource manager. The filtergraph will be a resource
  1420. // manager, internally delegating to the system wide resource manager
  1421. // (when there is one)
  1422. //
  1423. // use if: you need resources that are limited. Use the resource manager to
  1424. // resolve contention by registering the resource with this interface,
  1425. // and requesting it from this interface whenever needed.
  1426. //
  1427. // or use if: you detect focus changes which should affect resource usage.
  1428. // Notifying change of focus to the resource manager will cause the resource
  1429. // manager to switch contended resources to the objects that have the user's
  1430. // focus
  1431. [
  1432.     object,
  1433.     uuid(56a868ac-0ad4-11ce-b03a-0020af0ba770),
  1434.     pointer_default(unique)
  1435. ]
  1436. interface IResourceManager : IUnknown
  1437. {
  1438.     // tell the manager how many there are of a resource.
  1439.     // ok if already registered. will take new count. if new count
  1440.     // is lower, will de-allocate resources to new count.
  1441.     //
  1442.     // You get back a token that will be used in further calls.
  1443.     //
  1444.     // Passing a count of 0 will eliminate this resource. There is currently
  1445.     // no defined way to find the id without knowing the count.
  1446.     //
  1447.     HRESULT
  1448.     Register(
  1449.         [in] LPCWSTR pName,         // this named resource
  1450.         [in] LONG   cResource,      // has this many instances
  1451.         [out] LONG* plToken         // token placed here on return
  1452.         );
  1453.  
  1454.     HRESULT
  1455.     RegisterGroup(
  1456.         [in] LPCWSTR pName,         // this named resource group
  1457.         [in] LONG cResource,        // has this many resources
  1458.         [in, size_is(cResource)]
  1459.              LONG* palTokens,       // these are the contained resources
  1460.         [out] LONG* plToken         // group resource id put here on return
  1461.         );
  1462.  
  1463.     // request the use of a given, registered resource.
  1464.     // possible return values:
  1465.     //      S_OK == yes you can use it now
  1466.     //      S_FALSE == you will be called back when the resource is available
  1467.     //      other - there is an error.
  1468.     //
  1469.     // The priority of this request should be affected by the associated
  1470.     // focus object -- that is, when SetFocus is called for that focus
  1471.     // object (or a 'related' object) then my request should be put through.
  1472.     //
  1473.     // A filter should pass the filter's IUnknown here. The filtergraph
  1474.     // will match filters to the filtergraph, and will attempt to trace
  1475.     // filters to common source filters when checking focus objects.
  1476.     // The Focus object must be valid for the entire lifetime of the request
  1477.     // -- until you call CancelRequest or NotifyRelease(id, p, FALSE)
  1478.     HRESULT
  1479.     RequestResource(
  1480.         [in] LONG idResource,
  1481.         [in] IUnknown* pFocusObject,
  1482.         [in] IResourceConsumer* pConsumer
  1483.         );
  1484.  
  1485.  
  1486.     // notify the resource manager that an acquisition attempt completed.
  1487.     // Call this method after an AcquireResource method returned
  1488.     // S_FALSE to indicate asynchronous acquisition.
  1489.     // HR should be S_OK if the resource was successfully acquired, or a
  1490.     // failure code if the resource could not be acquired.
  1491.     HRESULT
  1492.     NotifyAcquire(
  1493.         [in] LONG idResource,
  1494.         [in] IResourceConsumer* pConsumer,
  1495.         [in] HRESULT hr);
  1496.  
  1497.     // Notify the resource manager that you have released a resource. Call
  1498.     // this in response to a ReleaseResource method, or when you have finished
  1499.     // with the resource. bStillWant should be TRUE if you still want the
  1500.     // resource when it is next available, or FALSE if you no longer want
  1501.     // the resource.
  1502.     HRESULT
  1503.     NotifyRelease(
  1504.         [in] LONG idResource,
  1505.         [in] IResourceConsumer* pConsumer,
  1506.         [in] BOOL bStillWant);
  1507.  
  1508.     // I don't currently have the resource, and I no longer need it.
  1509.     HRESULT
  1510.     CancelRequest(
  1511.         [in] LONG idResource,
  1512.         [in] IResourceConsumer* pConsumer);
  1513.  
  1514.     // Notify the resource manager that a given object has been given the
  1515.     // user's focus. In ActiveMovie, this will normally be a video renderer
  1516.     // whose window has received the focus. The filter graph will switch
  1517.     // contended resources to (in order):
  1518.     //      requests made with this same focus object
  1519.     //      requests whose focus object shares a common source with this
  1520.     //      requests whose focus object shares a common filter graph
  1521.     // After calling this, you *must* call ReleaseFocus before the IUnknown
  1522.     // becomes invalid, unless you can guarantee that another SetFocus
  1523.     // of a different object is done in the meantime. No addref is held.
  1524.     //
  1525.     // The resource manager will hold this pointer until replaced or cancelled,
  1526.     // and will use it to resolve resource contention. It will call
  1527.     // QueryInterface for IBaseFilter at least and if found will call methods on
  1528.     // that interface.
  1529.     HRESULT
  1530.     SetFocus(
  1531.         [in] IUnknown* pFocusObject);
  1532.  
  1533.     // Sets the focus to NULL if the current focus object is still
  1534.     // pFocusObject. Call this when
  1535.     // the focus object is about to be destroyed to ensure that no-one is
  1536.     // still referencing the object.
  1537.     HRESULT
  1538.     ReleaseFocus(
  1539.         [in] IUnknown* pFocusObject);
  1540.  
  1541.  
  1542.  
  1543. // !!! still need
  1544. //      -- app override (some form of SetPriority)
  1545. //      -- enumeration and description of resources
  1546.  
  1547. }
  1548.  
  1549.  
  1550. //
  1551. // Interface representing an object that can be notified about state
  1552. // and other changes within a filter graph. The filtergraph will call plug-in
  1553. // distributors that expose this optional interface so that they can
  1554. // respond to appropriate changes.
  1555. //
  1556. // Implement if: you are a plug-in distributor (your class id is found
  1557. // under HKCR\Interface\<IID>\Distributor= for some interface).
  1558. //
  1559. // Use if: you are the filtergraph.
  1560. [
  1561.     object,
  1562.     uuid(56a868af-0ad4-11ce-b03a-0020af0ba770),
  1563.     pointer_default(unique)
  1564. ]
  1565. interface IDistributorNotify : IUnknown
  1566. {
  1567.     // called when graph is entering stop state. Called before
  1568.     // filters are stopped.
  1569.     HRESULT Stop(void);
  1570.  
  1571.     // called when graph is entering paused state, before filters are
  1572.     // notified
  1573.     HRESULT Pause(void);
  1574.  
  1575.     // called when graph is entering running state, before filters are
  1576.     // notified. tStart is the stream-time offset parameter that will be
  1577.     // given to each filter's IBaseFilter::Run method.
  1578.     HRESULT Run(REFERENCE_TIME tStart);
  1579.  
  1580.     // called when the graph's clock is changing, with the new clock. Addref
  1581.     // the clock if you hold it beyond this method. Called before
  1582.     // the filters are notified.
  1583.     HRESULT SetSyncSource(
  1584.         [in] IReferenceClock * pClock);
  1585.  
  1586.     // called when the set of filters or their connections has changed.
  1587.     // Called on every AddFilter, RemoveFilter or ConnectDirect (or anything
  1588.     // that will lead to one of these).
  1589.     // You don't need to rebuild your list of interesting filters at this point
  1590.     // but you should release any refcounts you hold on any filters that
  1591.     // have been removed.
  1592.     HRESULT NotifyGraphChange(void);
  1593. }
  1594.  
  1595. typedef enum {
  1596.     AM_STREAM_INFO_START_DEFINED = 0x00000001,
  1597.     AM_STREAM_INFO_STOP_DEFINED  = 0x00000002,
  1598.     AM_STREAM_INFO_DISCARDING    = 0x00000004,
  1599.     AM_STREAM_INFO_STOP_SEND_EXTRA = 0x00000010
  1600. } AM_STREAM_INFO_FLAGS;
  1601.  
  1602. //  Stream information
  1603. typedef struct {
  1604.     REFERENCE_TIME tStart;
  1605.     REFERENCE_TIME tStop;
  1606.     DWORD dwStartCookie;
  1607.     DWORD dwStopCookie;
  1608.     DWORD dwFlags;
  1609. } AM_STREAM_INFO;
  1610.  
  1611. //
  1612. // IAMStreamControl
  1613. //
  1614.  
  1615. [
  1616.     object,
  1617.     uuid(36b73881-c2c8-11cf-8b46-00805f6cef60),
  1618.     pointer_default(unique)
  1619. ]
  1620. interface IAMStreamControl : IUnknown
  1621. {
  1622.     // The REFERENCE_TIME pointers may be null, which
  1623.     // indicates immediately.  If the pointer is non-NULL
  1624.     // and dwCookie is non-zero, then pins should send
  1625.     // EC_STREAM_CONTROL_STOPPED / EC_STREAM_CONTROL_STARTED
  1626.     // with an IPin pointer and the cookie, thus allowing
  1627.     // apps to tie the events back to their requests.
  1628.     // If either dwCookies is zero, or the pointer is null,
  1629.     // then no event is sent.
  1630.  
  1631.     // If you have a capture pin hooked up to a MUX input pin and they
  1632.     // both support IAMStreamControl, you'll want the MUX to signal the
  1633.     // stop so you know the last frame was written out.  In order for the
  1634.     // MUX to know it's finished, the capture pin will have to send one
  1635.     // extra sample after it was supposed to stop, so the MUX can trigger
  1636.     // off that.  So you would set bSendExtra to TRUE for the capture pin
  1637.     // Leave it FALSE in all other cases.
  1638.  
  1639.     HRESULT StartAt( [in] const REFERENCE_TIME * ptStart,
  1640.                      [in] DWORD dwCookie );
  1641.     HRESULT StopAt(  [in] const REFERENCE_TIME * ptStop,
  1642.                      [in] BOOL bSendExtra,
  1643.                      [in] DWORD dwCookie );
  1644.     HRESULT GetInfo( [out] AM_STREAM_INFO *pInfo);
  1645. }
  1646.  
  1647.  
  1648.  
  1649. //
  1650. // ISeekingPassThru
  1651. //
  1652.  
  1653. [
  1654.     object,
  1655.     uuid(36b73883-c2c8-11cf-8b46-00805f6cef60),
  1656.     pointer_default(unique)
  1657. ]
  1658. interface ISeekingPassThru : IUnknown
  1659. {
  1660.     HRESULT Init(  [in] BOOL bSupportRendering,
  1661.                    [in] IPin *pPin);
  1662. }
  1663.  
  1664.  
  1665.  
  1666. //
  1667. // IAMStreamConfig - pin interface
  1668. //
  1669.  
  1670. // A capture filter or compression filter's output pin
  1671. // supports this interface - no matter what data type you produce.
  1672.  
  1673. // This interface can be used to set the output format of a pin (as an
  1674. // alternative to connecting the pin using a specific media type).
  1675. // After setting an output format, the pin will use that format
  1676. // the next time it connects to somebody, so you can just Render that
  1677. // pin and get a desired format without using Connect(CMediaType)
  1678. // Your pin should do that by ONLY OFFERING the media type set in SetFormat
  1679. // in its enumeration of media types, and no others.  This will ensure that
  1680. // that format is indeed used for connection (or at least offer it first).
  1681. // An application interested in enumerating accepted mediatypes may have to
  1682. // do so BEFORE calling SetFormat.
  1683.  
  1684. // But this interface's GetStreamCaps function can get more information
  1685. // about accepted media types than the traditional way of enumerating a pin's
  1686. // media types, so it should typically be used instead.
  1687. // GetStreamCaps gets information about the kinds of formats allowed... how
  1688. // it can stretch and crop, and the frame rate and data rates allowed (for
  1689. // video)
  1690.  
  1691. // VIDEO EXAMPLE
  1692. //
  1693. // GetStreamCaps returns a whole array of {MediaType, Capabilities}.
  1694. // Let's say your capture card supports JPEG anywhere between 160x120 and
  1695. // 320x240, and also the size 640x480.  Also, say it supports RGB24 at
  1696. // resolutions between 160x120 and 320x240 but only multiples of 8.  You would
  1697. // expose these properties by offering a media type of 320 x 240 JPEG
  1698. // (if that is your default or preferred size) coupled with
  1699. // capabilities saying minimum 160x120 and maximum 320x240 with granularity of
  1700. // 1.  The next pair you expose is a media type of 640x480 JPEG coupled with
  1701. // capabilities of min 640x480 max 640x480.  The third pair is media type
  1702. // 320x240 RGB24 with capabilities min 160x120 max 320x240 granularity 8.
  1703. // In this way you can expose almost every quirk your card might have.
  1704. // An application interested in knowing what compression formats you provide
  1705. // can get all the pairs and make a list of all the unique sub types of the
  1706. // media types.
  1707. //
  1708. // If a filter's output pin is connected with a media type that has rcSource
  1709. // and rcTarget not empty, it means the filter is being asked to stretch the
  1710. // rcSource sub-rectangle of its InputSize (the format of the input pin for
  1711. // a compressor, and the largest bitmap a capture filter can generate with
  1712. // every pixel unique) into the rcTarget sub-rectangle of its output format.
  1713. // For instance, if a video compressor has as input 160x120 RGB, and as output
  1714. // 320x240 MPEG with an rcSource of (10,10,20,20) and rcTarget of (0,0,100,100)
  1715. // this means the compressor is being asked to take a 10x10 piece of the 160x120
  1716. // RGB bitmap, and make it fill the top 100x100 area of a 320x240 bitmap,
  1717. // leaving the rest of the 320x240 bitmap untouched.
  1718. // A filter does not have to support this and can fail to connect with a
  1719. // media type where rcSource and rcTarget are not empty.
  1720. //
  1721. // Your output pin is connected to the next filter with a certain media
  1722. // type (either directly or using the media type passed by SetFormat),
  1723. // and you need to look at the AvgBytesPerSecond field of the format
  1724. // of that mediatype to see what data rate you are being asked to compress
  1725. // the video to, and use that data rate.  Using the number of frames per
  1726. // second in AvgTimePerFrame, you can figure out how many bytes each frame
  1727. // is supposed to be.  You can make it smaller, but NEVER EVER make a bigger
  1728. // data rate.  For a video compressor, your input pin's media type tells you
  1729. // the frame rate (use that AvgTimePerFrame).  For a capture filter, the
  1730. // output media type tells you, so use that AvgTimePerFrame.
  1731. //
  1732. // The cropping rectangle described below is the same as the rcSrc of the
  1733. // output pin's media type.
  1734. //
  1735. // The output rectangle described below is the same of the width and height
  1736. // of the BITMAPINFOHEADER of the media type of the output pin's media type
  1737.  
  1738.  
  1739. // AUDIO EXAMPLE
  1740. //
  1741. // This API can return an array of pairs of (media type, capabilities).
  1742. // This can be used to expose all kinds of wierd capabilities.  Let's say you
  1743. // do any PCM frequency from 11,025 to 44,100 at 8 or 16 bit mono or
  1744. // stereo, and you also do 48,000 16bit stereo as a special combination.
  1745. // You would expose 3 pairs.  The first pair would have Min Freq of 11025 and
  1746. // Max Freq of 44100, with MaxChannels=2 and MinBits=8 and MaxBits=8 for the
  1747. // capabilites structure, and a media type of anything you like, maybe
  1748. // 22kHz, 8bit stereo as a default.
  1749. // The 2nd pair would be the same except for MinBits=16 and MaxBits=16 in
  1750. // the capabilities structure and the media type could be something like
  1751. // 44kHz, 16bit stereo as a default (the media type in the pair should always
  1752. // be something legal as described by the capabilities structure... the
  1753. // structure tells you how you can change the media type to produce other
  1754. // legal media types... for instance changing 44kHz to 29010Hz would be legal,
  1755. // but changing bits from 16 to 14 would not be.)
  1756. // The 3rd pair would be MinFreq=48000 MaxFreq=48000 MaxChannels=2
  1757. // MinBits=16 and MaxBits=16, and the media type would be 48kHz 16bit stereo.
  1758. // You can also use the Granularity elements of the structure (like the example
  1759. // for video) if you support values that multiples of n, eg.  you could say
  1760. // minimum bits per sample 8, max 16, and granularity 8 to describe doing
  1761. // either 8 or 16 bit all in one structure
  1762. //
  1763. // If you support non-PCM formats, the media type returned in GetStreamCaps
  1764. // can show which non-PCM formats you support (with a default sample rate,
  1765. // bit rate and channels) and the capabilities structure going with that
  1766. // media type can describe which other sample rates, bit rates and channels
  1767. // you support.
  1768.  
  1769. [
  1770.     object,
  1771.     uuid(C6E13340-30AC-11d0-A18C-00A0C9118956),
  1772.     pointer_default(unique)
  1773. ]
  1774. interface IAMStreamConfig : IUnknown
  1775. {
  1776.  
  1777.     // this is the structure returned by a VIDEO filter
  1778.     //
  1779.     typedef struct _VIDEO_STREAM_CONFIG_CAPS {
  1780.  
  1781.     GUID        guid;   // will be MEDIATYPE_Video
  1782.  
  1783.     // the logical or of all the AnalogVideoStandard's supported
  1784.     // typically zero if not supported
  1785.     ULONG       VideoStandard;
  1786.  
  1787.     // the inherent size of the incoming signal... taken from the input
  1788.     // pin for a compressor, or the largest size a capture filter can
  1789.     // digitize the signal with every pixel still unique
  1790.         SIZE        InputSize;
  1791.  
  1792.     // The input of a compressor filter may have to be connected for these
  1793.     // to be known
  1794.  
  1795.     // smallest rcSrc cropping rect allowed
  1796.         SIZE        MinCroppingSize;
  1797.     // largest rcSrc cropping rect allowed
  1798.         SIZE        MaxCroppingSize;
  1799.     // granularity of cropping size - eg only widths a multiple of 4 allowed
  1800.         int         CropGranularityX;
  1801.         int         CropGranularityY;
  1802.     // alignment of cropping rect - eg rect must start on multiple of 4
  1803.     int     CropAlignX;
  1804.     int     CropAlignY;
  1805.  
  1806.     // The input of a compressor filter may have to be connected for these
  1807.     // to be known
  1808.  
  1809.     // smallest bitmap this pin can produce
  1810.         SIZE        MinOutputSize;
  1811.     // largest bitmap this pin can produce
  1812.         SIZE        MaxOutputSize;
  1813.     // granularity of output bitmap size
  1814.         int         OutputGranularityX;
  1815.         int         OutputGranularityY;
  1816.     // !!! what about alignment of rcTarget inside BIH if different?
  1817.  
  1818.     // how well can you stretch in the x direction?  0==not at all
  1819.     // 1=pixel doubling 2=interpolation(2 taps) 3=better interpolation
  1820.     // etc.
  1821.     int     StretchTapsX;
  1822.     int     StretchTapsY;
  1823.     // how well can you shrink in the x direction?  0==not at all
  1824.     // 1=pixel doubling 2=interpolation(2 taps) 3=better interpolation
  1825.     // etc.
  1826.     int     ShrinkTapsX;
  1827.     int     ShrinkTapsY;
  1828.  
  1829.     // CAPTURE filter only - what frame rates are allowed?
  1830.         LONGLONG    MinFrameInterval;
  1831.         LONGLONG    MaxFrameInterval;
  1832.  
  1833.     // what data rates can this pin produce?
  1834.         LONG        MinBitsPerSecond;
  1835.         LONG        MaxBitsPerSecond;
  1836.     } VIDEO_STREAM_CONFIG_CAPS;
  1837.  
  1838.  
  1839.     // this is the structure returned by an AUDIO filter
  1840.     //
  1841.     typedef struct _AUDIO_STREAM_CONFIG_CAPS {
  1842.  
  1843.     GUID       guid;    // will be MEDIATYPE_Audio
  1844.     ULONG      MinimumChannels;
  1845.     ULONG      MaximumChannels;
  1846.     ULONG      ChannelsGranularity;
  1847.     ULONG      MinimumBitsPerSample;
  1848.     ULONG      MaximumBitsPerSample;
  1849.     ULONG      BitsPerSampleGranularity;
  1850.     ULONG      MinimumSampleFrequency;
  1851.     ULONG      MaximumSampleFrequency;
  1852.     ULONG      SampleFrequencyGranularity;
  1853.     } AUDIO_STREAM_CONFIG_CAPS;
  1854.  
  1855.     // - only allowed when pin is not streaming, else the call will FAIL
  1856.     // - If your output pin is not yet connected, and you can
  1857.     //   connect your output pin with this media type, you should
  1858.     //   succeed the call, and start offering it first (enumerate as format#0)
  1859.     //   from GetMediaType so that this format will be used to connect with
  1860.     //   when you do connect to somebody
  1861.     // - if your output pin is already connected, and you can provide this
  1862.     //   type, reconnect your pin.  If the other pin can't accept it, FAIL
  1863.     //   this call and leave your connection alone.
  1864.     HRESULT SetFormat(
  1865.             [in] AM_MEDIA_TYPE *pmt);
  1866.  
  1867.     // the format it's connected with, or will connect with
  1868.     // the application is responsible for calling DeleteMediaType(*ppmt);
  1869.     HRESULT GetFormat(
  1870.             [out] AM_MEDIA_TYPE **ppmt);
  1871.  
  1872.     // how many different Stream Caps structures are there?
  1873.     // also, how big is the stream caps structure?
  1874.     HRESULT GetNumberOfCapabilities(
  1875.             [out] int *piCount,
  1876.             [out] int *piSize); // pSCC of GetStreamCaps needs to be this big
  1877.  
  1878.     // - gets one of the pairs of {Mediatype, Caps}
  1879.     // - return S_FALSE if iIndex is too high
  1880.     // - the application is responsible for calling DeleteMediaType(*ppmt);
  1881.     // - the first thing pSCC points to is a GUID saying MEDIATYPE_Video
  1882.     //   or MEDIATYPE_Audio, so you can tell if you have a pointer to a
  1883.     //   VIDEO_STREAM_CONFIG_CAPS or an AUDIO_STREAM_CONFIG_CAPS structure
  1884.     //   There could potentially be many more possibilities other than video
  1885.     //   or audio.
  1886.     HRESULT GetStreamCaps(
  1887.         [in]  int iIndex,   // 0 to #caps-1
  1888.         [out] AM_MEDIA_TYPE **ppmt,
  1889.         [out] BYTE *pSCC);
  1890.  
  1891. }
  1892.  
  1893.  
  1894.  
  1895. // Interface to control interleaving of different streams in one file
  1896. [
  1897. object,
  1898. uuid(BEE3D220-157B-11d0-BD23-00A0C911CE86),
  1899. pointer_default(unique)
  1900. ]
  1901. interface IConfigInterleaving : IUnknown
  1902. {
  1903.     import "unknwn.idl";
  1904.  
  1905.     typedef enum
  1906.     {
  1907.         // uninterleaved - samples written out in the order they
  1908.         // arrive.
  1909.         INTERLEAVE_NONE,
  1910.  
  1911.         // approximate interleaving with less overhead for video
  1912.         // capture
  1913.         INTERLEAVE_CAPTURE,
  1914.  
  1915.         // full, precise interleaving. slower.
  1916.         INTERLEAVE_FULL,
  1917.  
  1918.         // samples written out in the order they arrive. writes are
  1919.         // buffered
  1920.         INTERLEAVE_NONE_BUFFERED
  1921.  
  1922.     } InterleavingMode;
  1923.  
  1924.     HRESULT put_Mode(
  1925.         [in] InterleavingMode mode
  1926.         );
  1927.  
  1928.     HRESULT get_Mode(
  1929.         [out] InterleavingMode *pMode
  1930.         );
  1931.  
  1932.     HRESULT put_Interleaving(
  1933.         [in] const REFERENCE_TIME *prtInterleave,
  1934.         [in] const REFERENCE_TIME *prtPreroll
  1935.         );
  1936.  
  1937.     HRESULT get_Interleaving(
  1938.         [out] REFERENCE_TIME *prtInterleave,
  1939.         [out] REFERENCE_TIME *prtPreroll
  1940.         );
  1941. }
  1942.  
  1943. // Interface to control the AVI mux
  1944. [
  1945. object,
  1946. uuid(5ACD6AA0-F482-11ce-8B67-00AA00A3F1A6),
  1947. pointer_default(unique)
  1948. ]
  1949. interface IConfigAviMux : IUnknown
  1950. {
  1951.     import "unknwn.idl";
  1952.  
  1953.     // control whether the AVI mux adjusts the frame rate or audio
  1954.     // sampling rate for drift when the file is closed. -1 to disables
  1955.     // this behavior.
  1956.     HRESULT SetMasterStream([in] LONG iStream);
  1957.     HRESULT GetMasterStream([out] LONG *pStream);
  1958.  
  1959.     // control whether the AVI mux writes out an idx1 index chunk for
  1960.     // compatibility with older AVI players.
  1961.     HRESULT SetOutputCompatibilityIndex([in] BOOL fOldIndex);
  1962.     HRESULT GetOutputCompatibilityIndex([out] BOOL *pfOldIndex);
  1963. }
  1964.  
  1965.     //---------------------------------------------------------------------
  1966.     //  CompressionCaps enum
  1967.     //---------------------------------------------------------------------
  1968.  
  1969.     // This tells you which features of IAMVideoCompression are supported
  1970.  
  1971.     // CanCrunch means that it can compress video to a specified data rate
  1972.     // If so, then the output pin's media type will contain that data rate
  1973.     // in the format's AvgBytesPerSecond field, and that should be used.
  1974.  
  1975.     typedef enum
  1976.     {
  1977.         CompressionCaps_CanQuality =  0x01,
  1978.         CompressionCaps_CanCrunch =   0x02,
  1979.         CompressionCaps_CanKeyFrame = 0x04,
  1980.         CompressionCaps_CanBFrame =   0x08,
  1981.         CompressionCaps_CanWindow =   0x10
  1982.     } CompressionCaps;
  1983.  
  1984.  
  1985.  
  1986.     //---------------------------------------------------------------------
  1987.     // IAMVideoCompression interface
  1988.     //
  1989.     // Control compression parameters - pin interface
  1990.     //---------------------------------------------------------------------
  1991.  
  1992.     // This interface is implemented by the output pin of a video capture
  1993.     // filter or video compressor that provides video data
  1994.  
  1995.     // You use this interface to control how video is compressed... how
  1996.     // many keyframes, etc., and to find information like capabilities and
  1997.     // the description of this compressor
  1998.  
  1999.     [
  2000.     object,
  2001.         uuid(C6E13343-30AC-11d0-A18C-00A0C9118956),
  2002.         pointer_default(unique)
  2003.     ]
  2004.     interface IAMVideoCompression : IUnknown
  2005.     {
  2006.     // - Only valid if GetInfo's pCapabilities sets
  2007.     //   CompressionCaps_CanKeyFrame
  2008.     // - KeyFrameRate < 0 means use the compressor default
  2009.     // - KeyFrames == 0 means only the first frame is a key
  2010.         HRESULT put_KeyFrameRate (
  2011.                     [in] long KeyFrameRate);
  2012.  
  2013.         HRESULT get_KeyFrameRate (
  2014.                     [out] long * pKeyFrameRate);
  2015.  
  2016.     // - Only valid if GetInfo's pCapabilities sets
  2017.     //   CompressionCaps_CanBFrame
  2018.     // - If keyframes are every 10, and there are 3 P Frames per key,
  2019.     //   they will be spaced evenly between the key frames and the other
  2020.     //   6 frames will be B frames
  2021.     // - PFramesPerKeyFrame < 0 means use the compressor default
  2022.         HRESULT put_PFramesPerKeyFrame (
  2023.                     [in] long PFramesPerKeyFrame);
  2024.  
  2025.         HRESULT get_PFramesPerKeyFrame (
  2026.                     [out] long * pPFramesPerKeyFrame);
  2027.  
  2028.     // - Only valid if GetInfo's pCapabilities sets
  2029.     //   CompressionCaps_CanQuality
  2030.     // - Controls image quality
  2031.     // - If you are compressing to a fixed data rate, a high quality
  2032.     //   means try and use all of the data rate, and a low quality means
  2033.     //   feel free to use much lower than the data rate if you want to.
  2034.         // - Quality < 0 means use the compressor default
  2035.         HRESULT put_Quality (
  2036.                     [in] double Quality);
  2037.  
  2038.         HRESULT get_Quality (
  2039.                     [out] double * pQuality);
  2040.  
  2041.     // If you have set a data rate of 100K/sec on a 10fps movie, that
  2042.     // will normally mean each frame must be <=10K.  But a window size
  2043.     // means every consecutive n frames must average to the data rate,
  2044.     // but an individual frame (if n > 1) is allowed to exceed the
  2045.     // frame size suggested by the data rate
  2046.         HRESULT put_WindowSize (
  2047.                     [in] DWORDLONG WindowSize);
  2048.  
  2049.         HRESULT get_WindowSize (
  2050.                     [out] DWORDLONG * pWindowSize);
  2051.  
  2052.     // - pszVersion might be "Version 2.1.0"
  2053.     // - pszDescription might be "Danny's awesome video compressor"
  2054.     // - pcbVersion and pcbDescription will be filled in with the
  2055.     //   required length if they are too short
  2056.     // - *pCapabilities is a logical OR of some CompressionCaps flags
  2057.         HRESULT GetInfo(
  2058.                     [out, size_is(*pcbVersion)] WCHAR * pszVersion,
  2059.                     [in,out] int *pcbVersion,
  2060.                     [out, size_is(*pcbDescription)] LPWSTR pszDescription,
  2061.                     [in,out] int *pcbDescription,
  2062.                     [out] long *pDefaultKeyFrameRate,
  2063.                     [out] long *pDefaultPFramesPerKey,
  2064.                     [out] double *pDefaultQuality,
  2065.                     [out] long *pCapabilities  //CompressionCaps
  2066.         );
  2067.  
  2068.     // - this means when this frame number comes along after the graph
  2069.     //   is running, make it a keyframe even if you weren't going to
  2070.         HRESULT OverrideKeyFrame(
  2071.                     [in]  long FrameNumber
  2072.         );
  2073.  
  2074.     // - Only valid if GetInfo's pCapabilities sets
  2075.     //   CompressionCaps_CanCrunch
  2076.     // - this means when this frame number comes along after the graph
  2077.     //   is running, make it this many bytes big instead of whatever size
  2078.     //   you were going to make it.
  2079.         HRESULT OverrideFrameSize(
  2080.                     [in]  long FrameNumber,
  2081.                     [in]  long Size
  2082.         );
  2083.  
  2084.     }
  2085.  
  2086.     //---------------------------------------------------------------------
  2087.     //  VfwCaptureDialogs enum
  2088.     //---------------------------------------------------------------------
  2089.  
  2090.     typedef enum
  2091.     {
  2092.          VfwCaptureDialog_Source = 0x01,
  2093.          VfwCaptureDialog_Format = 0x02,
  2094.          VfwCaptureDialog_Display = 0x04
  2095.     } VfwCaptureDialogs;
  2096.  
  2097.  
  2098.     //---------------------------------------------------------------------
  2099.     //  VfwCompressDialogs enum
  2100.     //---------------------------------------------------------------------
  2101.  
  2102.     typedef enum
  2103.     {
  2104.          VfwCompressDialog_Config = 0x01,
  2105.          VfwCompressDialog_About =  0x02,
  2106.          // returns S_OK if the dialog exists and can be shown, else S_FALSE
  2107.          VfwCompressDialog_QueryConfig = 0x04,
  2108.          VfwCompressDialog_QueryAbout =  0x08
  2109.     } VfwCompressDialogs;
  2110.  
  2111.  
  2112.     //---------------------------------------------------------------------
  2113.     // IAMVfwCaptureDialogs - filter interface
  2114.     //
  2115.     // Show a VfW capture driver dialog - SOURCE, FORMAT, or DISPLAY
  2116.     //---------------------------------------------------------------------
  2117.  
  2118.     // This interface is supported only by Microsoft's Video For Windows
  2119.     // capture driver Capture Filter.  It allows an application to bring up
  2120.     // one of the 3 driver dialogs that VfW capture drivers have.
  2121.  
  2122.     [
  2123.     object,
  2124.         local,
  2125.         uuid(D8D715A0-6E5E-11D0-B3F0-00AA003761C5),
  2126.         pointer_default(unique)
  2127.     ]
  2128.     interface IAMVfwCaptureDialogs : IUnknown
  2129.     {
  2130.         HRESULT HasDialog(
  2131.                     [in]  int iDialog   // VfwCaptureDialogs enum
  2132.         );
  2133.  
  2134.         HRESULT ShowDialog(
  2135.                     [in]  int iDialog,  // VfwCaptureDialogs enum
  2136.                     [in]  HWND hwnd
  2137.         );
  2138.  
  2139.         HRESULT SendDriverMessage(
  2140.                     [in]  int iDialog,  // VfwCaptureDialogs enum
  2141.                     [in]  int uMsg,
  2142.                     [in]  long dw1,
  2143.                     [in]  long dw2
  2144.         );
  2145.  
  2146.     // - iDialog can be one of the VfwCaptureDialogs enums
  2147.     // - HasDialog returns S_OK if it has the dialog, else S_FALSE
  2148.     // - ShowDialog can only be called when not streaming or when another
  2149.     //   dialog is not already up
  2150.     // - SendDriverMessage can send a secret message to the capture driver.
  2151.     //   USE IT AT YOUR OWN RISK!
  2152.     }
  2153.  
  2154.     //---------------------------------------------------------------------
  2155.     // IAMVfwCompressDialogs - filter interface
  2156.     //
  2157.     // Show a VfW codec driver dialog - CONFIG or ABOUT
  2158.     //---------------------------------------------------------------------
  2159.  
  2160.     // This interface is supported only by Microsoft's ICM Compressor filter
  2161.     // (Co).  It allows an application to bring up either the Configure or
  2162.     // About dialogs for the ICM codec that it is currently using.
  2163.  
  2164.     [
  2165.     object,
  2166.     local,
  2167.         uuid(D8D715A3-6E5E-11D0-B3F0-00AA003761C5),
  2168.         pointer_default(unique)
  2169.     ]
  2170.     interface IAMVfwCompressDialogs : IUnknown
  2171.     {
  2172.  
  2173.         // Bring up a dialog for this codec
  2174.         HRESULT ShowDialog(
  2175.             [in]  int iDialog,   // VfwCompressDialogs enum
  2176.             [in]  HWND hwnd
  2177.         );
  2178.  
  2179.         // Calls ICGetState and gives you the result
  2180.         HRESULT GetState(
  2181.             [out, size_is(*pcbState)] LPVOID pState,
  2182.             [in, out]  int *pcbState
  2183.         );
  2184.  
  2185.         // Calls ICSetState
  2186.         HRESULT SetState(
  2187.             [in, size_is(cbState)] LPVOID pState,
  2188.             [in]  int cbState
  2189.         );
  2190.  
  2191.         // Send a codec specific message
  2192.         HRESULT SendDriverMessage(
  2193.             [in]  int uMsg,
  2194.             [in]  long dw1,
  2195.             [in]  long dw2
  2196.         );
  2197.  
  2198.         // - iDialog can be one of the VfwCaptureDialogs enums
  2199.     // - ShowDialog can only be called when not streaming or when no other
  2200.     //   dialog is up already
  2201.     // - an application can call GetState after ShowDialog(CONFIG) to
  2202.     //   see how the compressor was configured and next time the graph
  2203.     //   is used, it can call SetState with the data it saved to return
  2204.     //   the codec to the state configured by the dialog box from last time
  2205.     // - GetState with a NULL pointer returns the size needed
  2206.     // - SendDriverMessage can send a secret message to the codec.
  2207.     //   USE IT AT YOUR OWN RISK!
  2208.     }
  2209.  
  2210.  
  2211.     //---------------------------------------------------------------------
  2212.     // IAMDroppedFrames interface
  2213.     //
  2214.     // Report status of capture - pin interface
  2215.     //---------------------------------------------------------------------
  2216.  
  2217.     // A capture filter's video output pin supports this.  It reports
  2218.     // how many frames were not sent (dropped), etc.
  2219.  
  2220.     // Every time your filter goes from STOPPED-->PAUSED, you reset all your
  2221.     // counts to zero.
  2222.  
  2223.     // An app may call this all the time while you are capturing to see how
  2224.     // capturing is going.  MAKE SURE you always return as current information
  2225.     // as possible while you are running.
  2226.  
  2227.     // When your capture filter starts running, it starts by sending frame 0,
  2228.     // then 1, 2, 3, etc.  The time stamp of each frame sent should correspond
  2229.     // to the graph clock's time when the image was digitized.  The end time
  2230.     // is the start time plus the duration of the video frame.
  2231.     // You should also set the MediaTime of each sample (SetMediaTime) as well.
  2232.     // This should be the frame number ie (0,1) (1,2) (2,3).
  2233.     // If a frame is dropped, a downstream filter will be able to tell easily
  2234.     // not by looking for gaps in the regular time stamps, but by noticing a
  2235.     // frame number is missing (eg.  (1,2) (2,3) (4,5) (5,6) means frame 3
  2236.     // was dropped.
  2237.  
  2238.     // Using the info provided by this interface, an application can figure out
  2239.     // the number of frames dropped, the frame rate achieved (the length of
  2240.     // time the graph was running divided by the number of frames not dropped),
  2241.     // and the data rate acheived (the length of time the graph was running
  2242.     // divided by the average frame size).
  2243.  
  2244.     // If your filter is running, then paused, and then run again, you need
  2245.     // to continue to deliver frames as if it was never paused.  The first
  2246.     // frame after the second RUN cannot be time stamped earlier than the last
  2247.     // frame sent before the pause.
  2248.  
  2249.     // Your filter must always increment the MediaTime of each sample sent.
  2250.     // Never send the same frame # twice, and never go back in time.  The
  2251.     // regular time stamp of a sample can also never go back in time.
  2252.  
  2253.     [
  2254.     object,
  2255.         uuid(C6E13344-30AC-11d0-A18C-00A0C9118956),
  2256.         pointer_default(unique)
  2257.     ]
  2258.     interface IAMDroppedFrames : IUnknown
  2259.     {
  2260.         // Get the number of dropped frames
  2261.         HRESULT GetNumDropped(
  2262.                     [out]  long * plDropped
  2263.  
  2264.         );
  2265.  
  2266.         //Get the number of non-dropped frames
  2267.         HRESULT GetNumNotDropped(
  2268.                     [out]  long * plNotDropped
  2269.  
  2270.         );
  2271.  
  2272.     // - plArray points to an array of lSize longs.  The filter will
  2273.     //   fill it with the frame number of the first lSize frames dropped.
  2274.     //   A filter may not have bothered to remember as many as you asked
  2275.     //   for, so it will set *plNumCopied to the number of frames it filled
  2276.     //   in.
  2277.         HRESULT GetDroppedInfo(
  2278.                     [in]   long lSize,
  2279.                     [out]  long * plArray,
  2280.                     [out]  long *  plNumCopied
  2281.         );
  2282.  
  2283.     // - This is the average size of the frames it didn't drop (in bytes)
  2284.         HRESULT GetAverageFrameSize(
  2285.                     [out]  long * plAverageSize
  2286.  
  2287.         );
  2288.  
  2289.     }
  2290.  
  2291.  
  2292.  
  2293.     cpp_quote("#define AMF_AUTOMATICGAIN -1.0")
  2294.  
  2295.     //---------------------------------------------------------------------
  2296.     // IAMAudioInputMixer interface
  2297.     //
  2298.     // Sets the recording levels, pan and EQ for the audio card inputs
  2299.     //---------------------------------------------------------------------
  2300.  
  2301.     // This interface is implemented by each input pin of an audio capture
  2302.     // filter, to tell it what level, panning, and EQ to use for each input.
  2303.     // The name of each pin will reflect the type of input, eg. "Line input 1"
  2304.     // or "Mic".  An application uses the pin names to decide how it wants to
  2305.     // set the recording levels
  2306.  
  2307.     // This interface can also be supported by the audio capture filter itself
  2308.     // to control to overall record level and panning after the mix
  2309.  
  2310.     [
  2311.     object,
  2312.         uuid(54C39221-8380-11d0-B3F0-00AA003761C5),
  2313.         pointer_default(unique)
  2314.     ]
  2315.     interface IAMAudioInputMixer : IUnknown
  2316.     {
  2317.     // This interface is only supported by the input pins, not the filter
  2318.     // If disabled, this channel will not be mixed in as part of the
  2319.     // recorded signal.
  2320.         HRESULT put_Enable (
  2321.             [in] BOOL fEnable); // TRUE=enable FALSE=disable
  2322.  
  2323.     //Is this channel enabled?
  2324.         HRESULT get_Enable (
  2325.             [out] BOOL *pfEnable);
  2326.  
  2327.     // When set to mono mode, making a stereo recording of this channel
  2328.     // will have both channels contain the same data... a mixture of the
  2329.     // left and right signals
  2330.         HRESULT put_Mono (
  2331.             [in] BOOL fMono);   // TRUE=mono FALSE=multi channel
  2332.  
  2333.         //all channels combined into a mono signal?
  2334.         HRESULT get_Mono (
  2335.             [out] BOOL *pfMono);
  2336.  
  2337.     // !!! WILL CARDS BE ABLE TO BOOST THE GAIN?
  2338.         //Set the record level for this channel
  2339.         HRESULT put_MixLevel (
  2340.             [in] double Level); // 0 = off, 1 = full (unity?) volume
  2341.             // AMF_AUTOMATICGAIN, if supported,
  2342.             // means automatic
  2343.  
  2344.         //Get the record level for this channel
  2345.         HRESULT get_MixLevel (
  2346.             [out] double *pLevel);
  2347.  
  2348.     // For instance, when panned full left, and you make a stereo recording
  2349.     // of this channel, you will record a silent right channel.
  2350.         HRESULT put_Pan (
  2351.             [in] double Pan);   // -1 = full left, 0 = centre, 1 = right
  2352.  
  2353.         //Get the pan for this channel
  2354.         HRESULT get_Pan (
  2355.             [out] double *pPan);
  2356.  
  2357.     // Boosts the bass of low volume signals before they are recorded
  2358.     // to compensate for the fact that your ear has trouble hearing quiet
  2359.     // bass sounds
  2360.         HRESULT put_Loudness (
  2361.             [in] BOOL fLoudness);// TRUE=on FALSE=off
  2362.  
  2363.         HRESULT get_Loudness (
  2364.             [out] BOOL *pfLoudness);
  2365.  
  2366.     // boosts or cuts the treble of the signal before it's recorded by
  2367.     // a certain amount of dB
  2368.         HRESULT put_Treble (
  2369.             [in] double Treble); // gain in dB (-ve = attenuate)
  2370.  
  2371.         //Get the treble EQ for this channel
  2372.         HRESULT get_Treble (
  2373.             [out] double *pTreble);
  2374.  
  2375.     // This is the maximum value allowed in put_Treble.  ie 6.0 means
  2376.     // any value between -6.0 and 6.0 is allowed
  2377.         HRESULT get_TrebleRange (
  2378.             [out] double *pRange); // largest value allowed
  2379.  
  2380.     // boosts or cuts the bass of the signal before it's recorded by
  2381.     // a certain amount of dB
  2382.         HRESULT put_Bass (
  2383.             [in] double Bass); // gain in dB (-ve = attenuate)
  2384.  
  2385.         // Get the bass EQ for this channel
  2386.         HRESULT get_Bass (
  2387.             [out] double *pBass);
  2388.  
  2389.     // This is the maximum value allowed in put_Bass.  ie 6.0 means
  2390.     // any value between -6.0 and 6.0 is allowed
  2391.         HRESULT get_BassRange (
  2392.             [out] double *pRange); // largest value allowed
  2393.  
  2394.     }
  2395.  
  2396.  
  2397.     //---------------------------------------------------------------------
  2398.     // IAMBufferNegotiation interface
  2399.     //
  2400.     // Tells a pin what kinds of buffers to use when connected
  2401.     //---------------------------------------------------------------------
  2402.  
  2403.     // This interface can be implemented by any pin that will connect to
  2404.     // another pin using IMemInputPin.  All capture filters should support
  2405.     // this interface.
  2406.  
  2407.     // SuggestAllocatorProperties is a way for an application to get
  2408.     // in on the buffer negotiation process for a pin.  This pin will use
  2409.     // the numbers given to it by the application as its request to the
  2410.     // allocator.  An application can use a negative number for any element
  2411.     // in the ALLOCATOR_PROPERTIES to mean "don't care".  An application must
  2412.     // call this function before the pin is connected, or it will be too late
  2413.     // To ensure that an application gets what it wants, it would be wise to
  2414.     // call this method on both pins being connected together, so the other
  2415.     // pin doesn't overrule the application's request.
  2416.  
  2417.     // GetAllocatorProperties can only be called after a pin is connected and
  2418.     // it returns the properties of the current allocator being used
  2419.  
  2420.     [
  2421.     object,
  2422.         uuid(56ED71A0-AF5F-11D0-B3F0-00AA003761C5),
  2423.         pointer_default(unique)
  2424.     ]
  2425.     interface IAMBufferNegotiation : IUnknown
  2426.     {
  2427.         HRESULT SuggestAllocatorProperties (
  2428.             [in] const ALLOCATOR_PROPERTIES *pprop);
  2429.  
  2430.         HRESULT GetAllocatorProperties (
  2431.             [out] ALLOCATOR_PROPERTIES *pprop);
  2432.  
  2433.     }
  2434.  
  2435.  
  2436.     //---------------------------------------------------------------------
  2437.     // AnalogVideoStandard enum
  2438.     //---------------------------------------------------------------------
  2439.  
  2440.     typedef enum tagAnalogVideoStandard
  2441.     {
  2442.         AnalogVideo_None     = 0x00000000,  // This is a digital sensor
  2443.         AnalogVideo_NTSC_M   = 0x00000001,  //        75 IRE Setup
  2444.         AnalogVideo_NTSC_M_J = 0x00000002,  // Japan,  0 IRE Setup
  2445.         AnalogVideo_NTSC_433 = 0x00000004,
  2446.  
  2447.         AnalogVideo_PAL_B    = 0x00000010,
  2448.         AnalogVideo_PAL_D    = 0x00000020,
  2449.         AnalogVideo_PAL_G    = 0x00000040,
  2450.         AnalogVideo_PAL_H    = 0x00000080,
  2451.         AnalogVideo_PAL_I    = 0x00000100,
  2452.         AnalogVideo_PAL_M    = 0x00000200,
  2453.         AnalogVideo_PAL_N    = 0x00000400,
  2454.  
  2455.         AnalogVideo_PAL_60   = 0x00000800,
  2456.  
  2457.         AnalogVideo_SECAM_B  = 0x00001000,
  2458.         AnalogVideo_SECAM_D  = 0x00002000,
  2459.         AnalogVideo_SECAM_G  = 0x00004000,
  2460.         AnalogVideo_SECAM_H  = 0x00008000,
  2461.         AnalogVideo_SECAM_K  = 0x00010000,
  2462.         AnalogVideo_SECAM_K1 = 0x00020000,
  2463.         AnalogVideo_SECAM_L  = 0x00040000,
  2464.         AnalogVideo_SECAM_L1 = 0x00080000,
  2465.  
  2466.         AnalogVideo_PAL_N_COMBO             // Argentina
  2467.                              = 0x00100000
  2468.     } AnalogVideoStandard;
  2469.  
  2470.     cpp_quote("#define AnalogVideo_NTSC_Mask  0x00000007")
  2471.     cpp_quote("#define AnalogVideo_PAL_Mask   0x00100FF0")
  2472.     cpp_quote("#define AnalogVideo_SECAM_Mask 0x000FF000")
  2473.  
  2474.  
  2475.     //---------------------------------------------------------------------
  2476.     // TunerInputType enum
  2477.     //---------------------------------------------------------------------
  2478.  
  2479.     typedef enum tagTunerInputType
  2480.     {
  2481.         TunerInputCable,
  2482.         TunerInputAntenna
  2483.     } TunerInputType;
  2484.  
  2485.     //---------------------------------------------------------------------
  2486.     // VideoCopyProtectionType enum
  2487.     //---------------------------------------------------------------------
  2488.  
  2489.     typedef enum
  2490.     {
  2491.         VideoCopyProtectionMacrovisionBasic,
  2492.         VideoCopyProtectionMacrovisionCBI
  2493.     } VideoCopyProtectionType;
  2494.  
  2495.     //---------------------------------------------------------------------
  2496.     // PhysicalConnectorType enum
  2497.     //---------------------------------------------------------------------
  2498.  
  2499.     typedef enum tagPhysicalConnectorType
  2500.     {
  2501.         PhysConn_Video_Tuner = 1,
  2502.         PhysConn_Video_Composite,
  2503.         PhysConn_Video_SVideo,
  2504.         PhysConn_Video_RGB,
  2505.         PhysConn_Video_YRYBY,
  2506.         PhysConn_Video_SerialDigital,
  2507.         PhysConn_Video_ParallelDigital,
  2508.         PhysConn_Video_SCSI,
  2509.         PhysConn_Video_AUX,
  2510.         PhysConn_Video_1394,
  2511.         PhysConn_Video_USB,
  2512.         PhysConn_Video_VideoDecoder,
  2513.         PhysConn_Video_VideoEncoder,
  2514.         PhysConn_Video_SCART,
  2515.         PhysConn_Video_Black,           
  2516.  
  2517.  
  2518.         PhysConn_Audio_Tuner = 0x1000,
  2519.         PhysConn_Audio_Line,
  2520.         PhysConn_Audio_Mic,
  2521.         PhysConn_Audio_AESDigital,
  2522.         PhysConn_Audio_SPDIFDigital,
  2523.         PhysConn_Audio_SCSI,
  2524.         PhysConn_Audio_AUX,
  2525.         PhysConn_Audio_1394,
  2526.         PhysConn_Audio_USB,
  2527.         PhysConn_Audio_AudioDecoder,
  2528.     } PhysicalConnectorType;
  2529.  
  2530.  
  2531.  
  2532.  
  2533.     //---------------------------------------------------------------------
  2534.     // IAMAnalogVideoDecoder interface
  2535.     //---------------------------------------------------------------------
  2536.  
  2537.     [
  2538.     object,
  2539.         uuid(C6E13350-30AC-11d0-A18C-00A0C9118956),
  2540.     pointer_default(unique)
  2541.     ]
  2542.     interface IAMAnalogVideoDecoder : IUnknown
  2543.     {
  2544.  
  2545.          //Gets the supported analog video standards (NTSC/M, PAL/B, SECAM/K1...
  2546.         HRESULT get_AvailableTVFormats(
  2547.                     [out] long *lAnalogVideoStandard
  2548.                     );
  2549.  
  2550.         //Sets or gets the current analog video standard (NTSC/M, PAL/B, SECAM/K1, ...
  2551.         HRESULT put_TVFormat(
  2552.                     [in] long lAnalogVideoStandard
  2553.                     );
  2554.  
  2555.         // Sets or gets the current analog video standard (NTSC/M, PAL/B, SECAM/K1, ...
  2556.         HRESULT get_TVFormat(
  2557.                     [out] long * plAnalogVideoStandard
  2558.                     );
  2559.  
  2560.         // True if horizontal sync is locked
  2561.         HRESULT get_HorizontalLocked (
  2562.                     [out] long * plLocked);
  2563.  
  2564.         // True if connected to a VCR (changes PLL timing)
  2565.         HRESULT put_VCRHorizontalLocking (
  2566.                     [in] long lVCRHorizontalLocking);
  2567.  
  2568.         HRESULT get_VCRHorizontalLocking (
  2569.                     [out] long * plVCRHorizontalLocking);
  2570.  
  2571.         // Returns the number of lines in the video signal")]
  2572.         HRESULT get_NumberOfLines (
  2573.                     [out] long *plNumberOfLines);
  2574.  
  2575.         // Enables or disables the output bus
  2576.         HRESULT put_OutputEnable (
  2577.                     [in] long lOutputEnable);
  2578.  
  2579.         HRESULT get_OutputEnable (
  2580.                     [out] long *plOutputEnable);
  2581.  
  2582.     }
  2583.  
  2584.  
  2585.     //---------------------------------------------------------------------
  2586.     // VideoProcAmp Property enum
  2587.     //---------------------------------------------------------------------
  2588.  
  2589.     typedef enum tagVideoProcAmpProperty
  2590.     {
  2591.         VideoProcAmp_Brightness,
  2592.         VideoProcAmp_Contrast,
  2593.         VideoProcAmp_Hue,
  2594.         VideoProcAmp_Saturation,
  2595.         VideoProcAmp_Sharpness,
  2596.         VideoProcAmp_Gamma,
  2597.         VideoProcAmp_ColorEnable,
  2598.         VideoProcAmp_WhiteBalance,
  2599.         VideoProcAmp_BacklightCompensation,
  2600.         VideoProcAmp_Gain
  2601.     } VideoProcAmpProperty;
  2602.  
  2603.     //---------------------------------------------------------------------
  2604.     // VideoProcAmp Flags enum
  2605.     //---------------------------------------------------------------------
  2606.  
  2607.     typedef enum tagVideoProcAmpFlags
  2608.     {
  2609.         VideoProcAmp_Flags_Auto   = 0x0001,
  2610.         VideoProcAmp_Flags_Manual = 0x0002
  2611.     } VideoProcAmpFlags;
  2612.  
  2613.     //---------------------------------------------------------------------
  2614.     // IAMVideoProcAmp interface
  2615.     //
  2616.     // Adjusts video quality in either the analog or digital domain.
  2617.     //
  2618.     //---------------------------------------------------------------------
  2619.  
  2620.     [
  2621.     object,
  2622.         uuid(C6E13360-30AC-11d0-A18C-00A0C9118956),
  2623.     pointer_default(unique)
  2624.     ]
  2625.     interface IAMVideoProcAmp : IUnknown
  2626.     {
  2627.         // Returns min, max, step size, and default values
  2628.         HRESULT GetRange(
  2629.             [in] long Property,         // Which property to query
  2630.             [out] long * pMin,          // Range minimum
  2631.             [out] long * pMax,          // Range maxumum
  2632.             [out] long * pSteppingDelta,// Step size
  2633.             [out] long * pDefault,      // Default value
  2634.             [out] long * pCapsFlags     // VideoProcAmpFlags
  2635.  
  2636.         );
  2637.  
  2638.         // Set a VideoProcAmp property
  2639.         HRESULT Set(
  2640.             [in]  long Property,        // VideoProcAmpProperty
  2641.             [in]  long lValue,          // Value to set
  2642.             [in]  long Flags            // VideoProcAmp_Flags_*
  2643.  
  2644.         );
  2645.  
  2646.         // Get a VideoProcAmp property
  2647.         HRESULT Get(
  2648.             [in]  long Property,        // VideoProcAmpProperty
  2649.             [out] long * lValue,        // Current value
  2650.             [out] long * Flags          // VideoProcAmp_Flags_*
  2651.         );
  2652.     }
  2653.  
  2654.  
  2655.     //---------------------------------------------------------------------
  2656.     // CameraControl Property enum
  2657.     //---------------------------------------------------------------------
  2658.  
  2659.     typedef enum tagCameraControlProperty
  2660.     {
  2661.         CameraControl_Pan,
  2662.         CameraControl_Tilt,
  2663.         CameraControl_Roll,
  2664.         CameraControl_Zoom,
  2665.         CameraControl_Exposure,
  2666.         CameraControl_Iris,
  2667.         CameraControl_Focus
  2668.     } CameraControlProperty;
  2669.  
  2670.     //---------------------------------------------------------------------
  2671.     // CameraControl Flags enum
  2672.     //---------------------------------------------------------------------
  2673.  
  2674.     typedef enum tagCameraControlFlags
  2675.     {
  2676.         CameraControl_Flags_Auto     = 0x0001,
  2677.         CameraControl_Flags_Manual   = 0x0002
  2678.     } CameraControlFlags;
  2679.  
  2680.     //---------------------------------------------------------------------
  2681.     // IAMCameraControl interface
  2682.     //
  2683.     // Control of local or remote cameras
  2684.     //---------------------------------------------------------------------
  2685.  
  2686.     [
  2687.     object,
  2688.         uuid(C6E13370-30AC-11d0-A18C-00A0C9118956),
  2689.     pointer_default(unique)
  2690.     ]
  2691.     interface IAMCameraControl : IUnknown
  2692.     {
  2693.         // Returns min, max, step size, and default values
  2694.         HRESULT GetRange(
  2695.             [in] long Property,         // Which property to query
  2696.             [out] long * pMin,          // Range minimum
  2697.             [out] long * pMax,          // Range maxumum
  2698.             [out] long * pSteppingDelta,// Step size
  2699.             [out] long * pDefault,      // Default value
  2700.             [out] long * pCapsFlags     // CamaeraControlFlags
  2701.  
  2702.         );
  2703.  
  2704.         // Set a CameraControl property
  2705.         HRESULT Set(
  2706.             [in]  long Property,        // CameraControlProperty
  2707.             [in]  long lValue,          // Value to set
  2708.             [in]  long Flags            // CameraControl_Flags_*
  2709.  
  2710.         );
  2711.  
  2712.         // Get a CameraControl property
  2713.         HRESULT Get(
  2714.             [in]  long Property,        // CameraControlProperty
  2715.             [out] long * lValue,        // Current value
  2716.             [out] long * Flags          // CameraControl_Flags_*
  2717.         );
  2718.     }
  2719.  
  2720.     //---------------------------------------------------------------------
  2721.     // VideoControl Flags enum
  2722.     //---------------------------------------------------------------------
  2723.  
  2724.     typedef enum tagVideoControlFlags
  2725.     {
  2726.         VideoControlFlag_FlipHorizontal        = 0x0001,
  2727.         VideoControlFlag_FlipVertical          = 0x0002,
  2728.         VideoControlFlag_ExternalTriggerEnable = 0x0004,
  2729.         VideoControlFlag_Trigger               = 0x0008
  2730.  
  2731.     } VideoControlFlags;
  2732.  
  2733.     //---------------------------------------------------------------------
  2734.     // IAMVideoControl interface
  2735.     //
  2736.     // Control of horizontal & vertical flip, external trigger,
  2737.     // and listing available frame rates
  2738.     //---------------------------------------------------------------------
  2739.  
  2740.     [
  2741.     object,
  2742.         uuid(6a2e0670-28e4-11d0-a18c-00a0c9118956),
  2743.     pointer_default(unique)
  2744.     ]
  2745.     interface IAMVideoControl : IUnknown
  2746.     {
  2747.         // What can the underlying hardware do?
  2748.         HRESULT GetCaps(
  2749.             [in]  IPin * pPin,          // the pin to query or control
  2750.             [out] long * pCapsFlags     // VideoControlFlag_*
  2751.  
  2752.         );
  2753.  
  2754.         // Set the mode of operation
  2755.         HRESULT SetMode(
  2756.             [in]  IPin * pPin,          // the pin to query or control
  2757.             [in]  long Mode             // VideoControlFlag_*
  2758.  
  2759.         );
  2760.  
  2761.         // Get the mode of operation
  2762.         HRESULT GetMode(
  2763.             [in]  IPin * pPin,          // the pin to query or control
  2764.             [out] long * Mode           // VideoControlFlag_*
  2765.         );
  2766.  
  2767.         // Get actual frame rate info for USB and 1394
  2768.         // This is only available when streaming
  2769.         HRESULT GetCurrentActualFrameRate(
  2770.             [in]  IPin * pPin,                  // the pin to query or control
  2771.             [out] LONGLONG * ActualFrameRate    // 100 nS units
  2772.         );
  2773.  
  2774.         // Get max available frame rate info for USB and 1394
  2775.         // Returns the max frame rate currently available based on bus bandwidth usage
  2776.         HRESULT GetMaxAvailableFrameRate(
  2777.             [in]  IPin * pPin,          // the pin to query or control
  2778.             [in]  long iIndex,          // 0 to IAMStreamConfig->GetNumberOfCapabilities-1
  2779.             [in]  SIZE Dimensions,      // width and height
  2780.             [out] LONGLONG * MaxAvailableFrameRate  // 100 nS units
  2781.         );
  2782.  
  2783.         // Get List of available frame rates
  2784.         HRESULT GetFrameRateList(
  2785.             [in]  IPin * pPin,           // the pin to query or control
  2786.             [in]  long iIndex,           // 0 to IAMStreamConfig->GetNumberOfCapabilities-1
  2787.             [in]  SIZE Dimensions,       // width and height
  2788.             [out] long * ListSize,       // Number of elements in the list
  2789.             [out] LONGLONG ** FrameRates // Array of framerates in 100 nS units
  2790.                                          // or NULL to just get ListSize
  2791.         );
  2792.  
  2793.     }
  2794.  
  2795.  
  2796.     //---------------------------------------------------------------------
  2797.     // IAMCrossbar interface
  2798.     //
  2799.     // Controls a routing matrix for analog or digital video or audio
  2800.     //---------------------------------------------------------------------
  2801.  
  2802.     [
  2803.     object,
  2804.         uuid(C6E13380-30AC-11d0-A18C-00A0C9118956),
  2805.     pointer_default(unique)
  2806.     ]
  2807.     interface IAMCrossbar : IUnknown
  2808.     {
  2809.  
  2810.         // How many pins are there?
  2811.         HRESULT get_PinCounts(
  2812.                 [out] long * OutputPinCount,        // count of output pins
  2813.                 [out] long * InputPinCount);        // count of input pins
  2814.  
  2815.         // True if routing is possible
  2816.         HRESULT CanRoute (
  2817.                 [in]  long OutputPinIndex,          // the output pin
  2818.                 [in]  long InputPinIndex);          // the input pin
  2819.  
  2820.         // Routes an input pin to an output pin
  2821.         HRESULT Route (
  2822.                 [in]  long OutputPinIndex,          // the output pin
  2823.                 [in]  long InputPinIndex);          // the input pin
  2824.  
  2825.         // Returns the input pin connected to a given output pin
  2826.         HRESULT get_IsRoutedTo (
  2827.                 [in]  long OutputPinIndex,          // the output pin
  2828.                 [out] long * InputPinIndex);        // the connected input pin
  2829.  
  2830.         // Returns a pin which is related to a given pin
  2831.         // (ie. this audio pin is related to a video pin)
  2832.         HRESULT get_CrossbarPinInfo (
  2833.                 [in] BOOL IsInputPin,               // TRUE for input pins
  2834.                 [in] long PinIndex,                 // a pin
  2835.                 [out] long * PinIndexRelated,       // Index of related pin
  2836.                 [out] long * PhysicalType);         // Physical type of pin
  2837.  
  2838.     }
  2839.  
  2840.  
  2841.     //---------------------------------------------------------------------
  2842.     // IAMTuner interface
  2843.     //
  2844.     // base tuner device
  2845.     //---------------------------------------------------------------------
  2846.     
  2847.     // predefined subchannel values
  2848.     typedef enum tagAMTunerSubChannel
  2849.     {
  2850.         AMTUNER_SUBCHAN_NO_TUNE     = -2,   // don't tune
  2851.         AMTUNER_SUBCHAN_DEFAULT     = -1    // use default sub chan
  2852.     } AMTunerSubChannel;
  2853.     
  2854.     // predefined signal strength values
  2855.     typedef enum tagAMTunerSignalStrength
  2856.     {
  2857.         AMTUNER_HASNOSIGNALSTRENGTH = -1,   // cannot indicate signal strength
  2858.         AMTUNER_NOSIGNAL            = 0,    // no signal available
  2859.         AMTUNER_SIGNALPRESENT       = 1     // signal present
  2860.     } AMTunerSignalStrength;
  2861.  
  2862.     // specifies the mode of operation of the tuner 
  2863.     typedef enum tagAMTunerModeType
  2864.     {
  2865.         AMTUNER_MODE_DEFAULT    = 0x0000,   // default tuner mode
  2866.         AMTUNER_MODE_TV         = 0x0001,   // tv
  2867.         AMTUNER_MODE_FM_RADIO   = 0x0002,   // fm radio
  2868.         AMTUNER_MODE_AM_RADIO   = 0x0004,   // am radio
  2869.         AMTUNER_MODE_DSS        = 0x0008,   // dss
  2870.     } AMTunerModeType;
  2871.     
  2872.     // Events reported by IAMTunerNotification
  2873.     typedef enum tagAMTunerEventType{
  2874.         AMTUNER_EVENT_CHANGED   = 0x0001,   // status changed
  2875.     } AMTunerEventType;
  2876.     
  2877.     interface IAMTunerNotification;
  2878.  
  2879.     [
  2880.         object,
  2881.         uuid(211A8761-03AC-11d1-8D13-00AA00BD8339),
  2882.         pointer_default(unique)
  2883.     ]
  2884.     interface IAMTuner : IUnknown
  2885.     {
  2886.         // Sets and gets the Channel
  2887.         HRESULT put_Channel(
  2888.             [in] long lChannel,
  2889.             [in] long lVideoSubChannel,
  2890.             [in] long lAudioSubChannel
  2891.             );
  2892.         HRESULT get_Channel(
  2893.             [out] long *plChannel,
  2894.             [out] long *plVideoSubChannel,
  2895.             [out] long *plAudioSubChannel
  2896.             );
  2897.     
  2898.         // Gets the minimum and maximum channel available
  2899.         HRESULT ChannelMinMax(
  2900.             [out] long *lChannelMin,
  2901.             [out] long *lChannelMax
  2902.             );
  2903.     
  2904.         // CountryCode is the same as the international
  2905.         // long distance telephone dialing prefix
  2906.         
  2907.         HRESULT put_CountryCode(
  2908.             [in] long lCountryCode
  2909.             );
  2910.         HRESULT get_CountryCode(
  2911.             [out] long *plCountryCode
  2912.             );
  2913.     
  2914.         HRESULT put_TuningSpace(
  2915.             [in] long lTuningSpace
  2916.             );
  2917.         HRESULT get_TuningSpace(
  2918.             [out] long *plTuningSpace
  2919.             );
  2920.     
  2921.         [local] HRESULT Logon(
  2922.             [in] HANDLE hCurrentUser
  2923.             );
  2924.         HRESULT Logout();
  2925.     
  2926.         // Signal status for current channel
  2927.         // signal strength == TUNER_NOSIGNAL, or strength value
  2928.         HRESULT SignalPresent(
  2929.             [out] long * plSignalStrength   // AMTunerSignalStrength
  2930.             );
  2931.     
  2932.         // allow multifunction tuner to be switch between modes
  2933.         HRESULT put_Mode(
  2934.             [in] AMTunerModeType lMode      // AMTunerModeType
  2935.             );
  2936.         HRESULT get_Mode(
  2937.             [out] AMTunerModeType *plMode   // AMTunerModeType
  2938.             );
  2939.     
  2940.         // retrieve a bitmask of the possible modes
  2941.         HRESULT GetAvailableModes(
  2942.             [out] long *plModes             // AMTunerModeType
  2943.             );
  2944.     
  2945.         // allow IAMTuner clients to receive event notification
  2946.         HRESULT RegisterNotificationCallBack(
  2947.             [in] IAMTunerNotification *pNotify,
  2948.             [in] long lEvents       // bitmask from AMTunerEventType enumeration
  2949.             );
  2950.         HRESULT UnRegisterNotificationCallBack(
  2951.             [in] IAMTunerNotification *pNotify
  2952.             );
  2953.     }
  2954.     
  2955.     //---------------------------------------------------------------------
  2956.     // IAMTunerNotification interface
  2957.     //
  2958.     // Provided to IAMTuner if notification callbacks are desired
  2959.     //---------------------------------------------------------------------
  2960.     
  2961.     [
  2962.         object,
  2963.         uuid(211A8760-03AC-11d1-8D13-00AA00BD8339),
  2964.         pointer_default(unique)
  2965.     ]
  2966.     interface IAMTunerNotification : IUnknown
  2967.     {
  2968.         HRESULT OnEvent([in] AMTunerEventType Event);
  2969.     }
  2970.     
  2971.     
  2972.     //---------------------------------------------------------------------
  2973.     // IAMTVTuner interface
  2974.     //
  2975.     // Controls an analog TV tuner device
  2976.     //---------------------------------------------------------------------
  2977.  
  2978.     [
  2979.         object,
  2980.         uuid(211A8766-03AC-11d1-8D13-00AA00BD8339),
  2981.         pointer_default(unique)
  2982.     ]
  2983.     interface IAMTVTuner : IAMTuner
  2984.     {
  2985.         // Gets the supported analog video standards (NTSC/M, PAL/B, SECAM/K1, ...
  2986.         HRESULT get_AvailableTVFormats(
  2987.             [out] long *lAnalogVideoStandard
  2988.             );
  2989.     
  2990.         // Gets the current analog video standard (NTSC/M, PAL/B, SECAM/K1, ...)
  2991.         HRESULT get_TVFormat(
  2992.             [out] long * plAnalogVideoStandard
  2993.             );
  2994.     
  2995.         // Scans for a signal on a given channel
  2996.         // NOTE: this is equivalent to put_Channel(), SignalStrength()
  2997.         HRESULT AutoTune(
  2998.             [in] long lChannel,
  2999.             [out] long * plFoundSignal
  3000.             );
  3001.     
  3002.         // Saves the fine tuning information for all channels")]
  3003.         HRESULT StoreAutoTune();
  3004.     
  3005.         // The number of TV sources plugged into the tuner
  3006.         HRESULT get_NumInputConnections(
  3007.             [out] long * plNumInputConnections
  3008.             );
  3009.     
  3010.         // Sets or gets the tuner input type (Cable or Antenna)
  3011.         HRESULT put_InputType(
  3012.             [in] long lIndex,
  3013.             [in] TunerInputType InputType
  3014.             );
  3015.         HRESULT get_InputType(
  3016.             [in] long lIndex,
  3017.             [out] TunerInputType * pInputType
  3018.             );
  3019.     
  3020.         // Sets or gets the tuner input
  3021.         HRESULT put_ConnectInput(
  3022.             [in] long lIndex
  3023.             );
  3024.         HRESULT get_ConnectInput(
  3025.             [out] long *plIndex
  3026.             );
  3027.     
  3028.         // Gets the video and audio carrier frequencies
  3029.         HRESULT get_VideoFrequency(
  3030.             [out] long *lFreq
  3031.             );
  3032.         HRESULT get_AudioFrequency(
  3033.             [out] long *lFreq
  3034.             );
  3035.     }
  3036.  
  3037.     
  3038.     //---------------------------------------------------------------------
  3039.     // IBPCSatelliteTuner interface
  3040.     //
  3041.     // An interface supporting Satellite tuning-related functions
  3042.     //---------------------------------------------------------------------
  3043.     [
  3044.         object,
  3045.         local,
  3046.         uuid(211A8765-03AC-11d1-8D13-00AA00BD8339),
  3047.         pointer_default(unique)
  3048.     ]
  3049.     interface IBPCSatelliteTuner : IAMTuner
  3050.     {
  3051.         HRESULT get_DefaultSubChannelTypes(
  3052.             [out] long *plDefaultVideoType, // Provider-specific service type
  3053.             [out] long *plDefaultAudioType  // Provider-specific service type
  3054.             );
  3055.     
  3056.         HRESULT put_DefaultSubChannelTypes(
  3057.             [in] long lDefaultVideoType,    // Provider-specific service type
  3058.             [in] long lDefaultAudioType     // Provider-specific service type
  3059.             );
  3060.     
  3061.         HRESULT IsTapingPermitted();        // S_OK yes, S_FALSE no
  3062.     }
  3063.  
  3064.  
  3065.  
  3066.     //---------------------------------------------------------------------
  3067.     // IAMTVAudio interface
  3068.     //
  3069.     // TV Audio control
  3070.     //---------------------------------------------------------------------
  3071.     
  3072.     typedef enum tagTVAudioMode
  3073.     {
  3074.         AMTVAUDIO_MODE_MONO         = 0x0001,       // Mono                 
  3075.         AMTVAUDIO_MODE_STEREO       = 0x0002,       // Stereo
  3076.         AMTVAUDIO_MODE_LANG_A       = 0x0010,       // Primary language
  3077.         AMTVAUDIO_MODE_LANG_B       = 0x0020,       // 2nd avail language
  3078.         AMTVAUDIO_MODE_LANG_C       = 0x0040,       // 3rd avail language
  3079.     } TVAudioMode;
  3080.  
  3081.     // Events reported by IAMTVAudioNotification
  3082.     typedef enum tagAMTVAudioEventType
  3083.     {
  3084.         AMTVAUDIO_EVENT_CHANGED     = 0x0001,       // mode changed
  3085.     } AMTVAudioEventType;
  3086.  
  3087.     interface IAMTVAudioNotification;
  3088.  
  3089.     [
  3090.         object,
  3091.         local,
  3092.         uuid(83EC1C30-23D1-11d1-99E6-00A0C9560266),
  3093.         pointer_default(unique)
  3094.     ]
  3095.     interface IAMTVAudio : IUnknown
  3096.     {
  3097.         // retrieve a bitmask of the formats available in the hardware
  3098.         HRESULT GetHardwareSupportedTVAudioModes(
  3099.             [out] long *plModes             // TVAudioMode
  3100.             );
  3101.             
  3102.         // retrieve a bitmask of the possible modes
  3103.         HRESULT GetAvailableTVAudioModes(
  3104.             [out] long *plModes             // TVAudioMode
  3105.             );
  3106.             
  3107.         HRESULT get_TVAudioMode(
  3108.             [out] long *plMode              // TVAudioMode
  3109.             );
  3110.         HRESULT put_TVAudioMode(
  3111.             [in] long lMode                 // TVAudioMode
  3112.             );
  3113.  
  3114.         // allow IAMTVAudio clients to receive event notification
  3115.         HRESULT RegisterNotificationCallBack(
  3116.             [in] IAMTunerNotification *pNotify,
  3117.             [in] long lEvents       // bitmask from AMTVAudioEventType enumeration
  3118.             );
  3119.         HRESULT UnRegisterNotificationCallBack(
  3120.             IAMTunerNotification *pNotify
  3121.             );
  3122.     }
  3123.  
  3124.     //---------------------------------------------------------------------
  3125.     // IAMTVAudioNotification interface
  3126.     //
  3127.     // Provided to IAMTVAudio clients if notification callbacks are desired
  3128.     //---------------------------------------------------------------------
  3129.     
  3130.     [
  3131.         object,
  3132.         local,
  3133.         uuid(83EC1C33-23D1-11d1-99E6-00A0C9560266),
  3134.         pointer_default(unique)
  3135.     ]
  3136.     interface IAMTVAudioNotification : IUnknown
  3137.     {
  3138.         HRESULT OnEvent([in] AMTVAudioEventType Event);
  3139.     }
  3140.  
  3141.  
  3142.  
  3143.  
  3144.     //---------------------------------------------------------------------
  3145.     // IAMAnalogVideoEncoder interface
  3146.     //---------------------------------------------------------------------
  3147.  
  3148.     [
  3149.    object,
  3150.         uuid(C6E133B0-30AC-11d0-A18C-00A0C9118956),
  3151.     pointer_default(unique)
  3152.     ]
  3153.     interface IAMAnalogVideoEncoder : IUnknown
  3154.     {
  3155.         // Gets the supported analog video standards (NTSC/M, PAL/B, SECAM/K1, ...)
  3156.         HRESULT get_AvailableTVFormats(
  3157.                     [out] long *lAnalogVideoStandard
  3158.                     );
  3159.  
  3160.         // Sets or gets the current analog video standard (NTSC/M, PAL/B, SECAM/K1, ...)
  3161.         HRESULT put_TVFormat(
  3162.                     [in] long lAnalogVideoStandard
  3163.                     );
  3164.  
  3165.         HRESULT get_TVFormat(
  3166.                     [out] long * plAnalogVideoStandard
  3167.                     );
  3168.  
  3169.         // Sets or gets the copy protection
  3170.         HRESULT put_CopyProtection (
  3171.                     [in]  long lVideoCopyProtection); // VideoCopyProtectionType
  3172.  
  3173.         HRESULT get_CopyProtection (
  3174.                     [out] long *lVideoCopyProtection); // VideoCopyProtectionType
  3175.  
  3176.  
  3177.         // Enables and disables close captioning
  3178.         HRESULT put_CCEnable (
  3179.                     [in] long lCCEnable);
  3180.  
  3181.         HRESULT get_CCEnable (
  3182.                     [out] long *lCCEnable);
  3183.  
  3184.     }
  3185.  
  3186.     // used by IKsPropertySet set AMPROPSETID_Pin
  3187.     typedef enum {
  3188.     AMPROPERTY_PIN_CATEGORY,
  3189.         AMPROPERTY_PIN_MEDIUM
  3190.     } AMPROPERTY_PIN;
  3191.  
  3192.     //---------------------------------------------------------------------
  3193.     // IKsPropertySet interface
  3194.     //
  3195.     // Sets or gets a property identified by a property set GUID and a
  3196.     // property ID.
  3197.     //
  3198.     // Return codes for all 3 methods:
  3199.     //    E_PROP_SET_UNSUPPORTED  the property set is not supported
  3200.     //    E_PROP_ID_UNSUPPORTED   the property ID is not supported
  3201.     //                                for the specified property set
  3202.     //---------------------------------------------------------------------
  3203.  
  3204. cpp_quote("#ifndef _IKsPropertySet_")
  3205. cpp_quote("#define _IKsPropertySet_")
  3206.  
  3207.     //---------------------------------------------------------------------
  3208.     // #defines for IKsPropertySet::QuerySupported return result in pTypeSupport
  3209.     //---------------------------------------------------------------------
  3210.  
  3211. cpp_quote("#define KSPROPERTY_SUPPORT_GET  1")
  3212. cpp_quote("#define KSPROPERTY_SUPPORT_SET  2")
  3213.  
  3214.  
  3215.     [
  3216.     object,
  3217.         uuid(31EFAC30-515C-11d0-A9AA-00AA0061BE93),
  3218.     pointer_default(unique)
  3219.     ]
  3220.     interface IKsPropertySet : IUnknown
  3221.     {
  3222.         [local] HRESULT Set(
  3223.                     [in]    REFGUID     guidPropSet,
  3224.                     [in]    DWORD       dwPropID,
  3225.                     [in, size_is(cbInstanceData)] LPVOID pInstanceData,
  3226.                     [in]    DWORD       cbInstanceData,
  3227.                     [in, size_is(cbPropData)] LPVOID pPropData,
  3228.                     [in]    DWORD       cbPropData);
  3229.  
  3230.         [call_as(Set)] HRESULT RemoteSet(
  3231.                     [in]    REFGUID     guidPropSet,
  3232.                     [in]    DWORD       dwPropID,
  3233.                     [in, size_is(cbInstanceData)] byte * pInstanceData,
  3234.                     [in]    DWORD       cbInstanceData,
  3235.                     [in, size_is(cbPropData)] byte * pPropData,
  3236.                     [in]    DWORD       cbPropData);
  3237.  
  3238.         // To get a property, the caller allocates a buffer which the called
  3239.         // function fills in.  To determine necessary buffer size, call Get with
  3240.         // pPropData=NULL and cbPropData=0.
  3241.         [local] HRESULT Get(
  3242.                     [in]    REFGUID     guidPropSet,
  3243.                     [in]    DWORD       dwPropID,
  3244.                     [in, size_is(cbInstanceData)] LPVOID pInstanceData,
  3245.                     [in]    DWORD       cbInstanceData,
  3246.                     [out, size_is(cbPropData)] LPVOID pPropData,
  3247.                     [in]    DWORD       cbPropData,
  3248.                     [out]   DWORD *     pcbReturned);
  3249.  
  3250.         [call_as(Get)] HRESULT RemoteGet(
  3251.                     [in]    REFGUID     guidPropSet,
  3252.                     [in]    DWORD       dwPropID,
  3253.                     [in, size_is(cbInstanceData)] byte * pInstanceData,
  3254.                     [in]    DWORD       cbInstanceData,
  3255.                     [out, size_is(cbPropData)] byte * pPropData,
  3256.                     [in]    DWORD       cbPropData,
  3257.                     [out]   DWORD *     pcbReturned);
  3258.         // QuerySupported must either return E_NOTIMPL or correctly indicate
  3259.         // if getting or setting the property set and property is supported.
  3260.         // S_OK indicates the property set and property ID combination is
  3261.         HRESULT QuerySupported(
  3262.                     [in]    REFGUID     guidPropSet,
  3263.                     [in]    DWORD       dwPropID,
  3264.                     [out]   DWORD       *pTypeSupport);
  3265.     }
  3266. cpp_quote("#endif // _IKsPropertySet_")
  3267.  
  3268. [
  3269. object,
  3270. uuid(6025A880-C0D5-11d0-BD4E-00A0C911CE86),
  3271. pointer_default(unique)
  3272. ]
  3273. interface IMediaPropertyBag : IPropertyBag
  3274. {
  3275.     import "ocidl.idl";
  3276.  
  3277.     typedef IMediaPropertyBag *LPMEDIAPROPERTYBAG;
  3278.  
  3279.     // return the i'th element in the property bag
  3280.     HRESULT EnumProperty(
  3281.         [in]  ULONG iProperty,
  3282.         [in, out] VARIANT * pvarPropertyName,
  3283.         [in, out] VARIANT * pvarPropertyValue
  3284.         );
  3285.  
  3286. }
  3287.  
  3288.  
  3289. [
  3290. object,
  3291. uuid(5738E040-B67F-11d0-BD4D-00A0C911CE86),
  3292. pointer_default(unique)
  3293. ]
  3294. interface IPersistMediaPropertyBag : IPersist
  3295. {
  3296.     import "ocidl.idl";
  3297.     import "unknwn.idl";
  3298.  
  3299.     HRESULT InitNew(
  3300.         void
  3301.         );
  3302.  
  3303.     HRESULT Load(
  3304.         [in] IMediaPropertyBag * pPropBag,
  3305.         [in] IErrorLog * pErrorLog
  3306.         );
  3307.  
  3308.     HRESULT Save(
  3309.         [in] IMediaPropertyBag * pPropBag,
  3310.         [in] BOOL fClearDirty,
  3311.         [in] BOOL fSaveAllProperties
  3312.         );
  3313.  
  3314.  
  3315.     typedef IPersistMediaPropertyBag * LPPERSISTMEDIAPROPERTYBAG;
  3316. }
  3317.  
  3318.  
  3319.    //---------------------------------------------------------------------
  3320.    //
  3321.    // Defines IAMPhysicalPinInfo Interface
  3322.    //
  3323.    // Returns an enum and string that describes an input pin's physical type.
  3324.    //
  3325.    // Implement if: you have physical input pins such as video or audio (like
  3326.    // on a video capture card or a VCR)
  3327.    //
  3328.    // Use if: you want to communicate to a user available physical input pins
  3329.    // and allow them to select the active one if there is more than one
  3330.    //---------------------------------------------------------------------
  3331.  
  3332.  
  3333. [
  3334.     object,
  3335.      uuid(F938C991-3029-11cf-8C44-00AA006B6814),
  3336.      pointer_default(unique)
  3337.  ]
  3338. interface IAMPhysicalPinInfo : IUnknown {
  3339.  
  3340.     // Returns VFW_E_NO_ACCEPTABLE_TYPES if not a physical pin
  3341.     HRESULT GetPhysicalType(
  3342.         [out] long *pType,          // the enum representing the Physical Type
  3343.         [out] LPOLESTR *ppszType        // a friendly name
  3344.     );
  3345. }
  3346. typedef IAMPhysicalPinInfo *PAMPHYSICALPININFO;
  3347.  
  3348.    //---------------------------------------------------------------------
  3349.    // Defines IAMExtDevice Interface
  3350.    //
  3351.    // Base interface for external professional devices
  3352.    //
  3353.    // Implement if: the filter controls an external device such as a VCR,
  3354.    // timecode reader/generator, etc.  The intent is to build a object from
  3355.    // this implementation plus another that specifically describes the device,
  3356.    // such as IAMExtTransport.
  3357.    //
  3358.    // Use if: you want to control and external device such as a VCR
  3359.    //
  3360.    // See edevdefs.h for the enumerated parameter list
  3361.    //---------------------------------------------------------------------
  3362.  [
  3363.     object,
  3364.      uuid(B5730A90-1A2C-11cf-8C23-00AA006B6814),
  3365.     pointer_default(unique)
  3366.  ]
  3367.  interface IAMExtDevice : IUnknown
  3368.  {
  3369.     // General device capabilities property.  See edevdefs.h for supported
  3370.     // values
  3371.     HRESULT GetCapability(
  3372.         [in] long Capability,       // identify the property
  3373.         [out] long *pValue,         // return value
  3374.         [out] double *pdblValue     // return value
  3375.     );
  3376.  
  3377.     // Get external device identification string.  Usually the model #
  3378.     // of the device
  3379.     HRESULT get_ExternalDeviceID(
  3380.         [out] LPOLESTR *ppszData        // ID string
  3381.     );
  3382.     
  3383.     HRESULT get_ExternalDeviceVersion(
  3384.         [out] LPOLESTR *ppszData        // revision string
  3385.     );
  3386.     
  3387.     // Controls the external device's power mode
  3388.     HRESULT put_DevicePower([in] long PowerMode
  3389.     );
  3390.     HRESULT get_DevicePower([out] long *pPowerMode
  3391.     );
  3392.     
  3393.     // Some devices need to be reset in some way, i.e., rewinding a VCR
  3394.     // to the beginning of the tape and resetting the counter to zero.
  3395.     HRESULT Calibrate(
  3396.         [in] HEVENT hEvent,
  3397.         [in] long Mode,
  3398.         [out] long *pStatus     // OATRUE is active, OAFALSE is inactive
  3399.     );
  3400.  
  3401.     // Selects the device's communications port, i.e.,COM1, IEEE1394, etc.
  3402.     // See edevdefs.h for enums
  3403.     HRESULT put_DevicePort([in] long DevicePort
  3404.     );
  3405.     HRESULT get_DevicePort([out] long *pDevicePort
  3406.     );
  3407.     
  3408. }
  3409. typedef IAMExtDevice *PEXTDEVICE;
  3410.  
  3411.    //---------------------------------------------------------------------
  3412.    // Defines IAMExtTransport Interface
  3413.    //
  3414.    // Contains properties and methods that control behavior of an external
  3415.    // transport device such as a VTR
  3416.    //
  3417.    // Implement if: you control such a device.  Intended to be agregated
  3418.    // with IAMExtDevice.
  3419.    //
  3420.    // Use if: you want to control such a device
  3421.    //
  3422.    // See edevdefs.h for the parameter lists
  3423.    //---------------------------------------------------------------------
  3424. [
  3425.     object,
  3426.      uuid(A03CD5F0-3045-11cf-8C44-00AA006B6814),
  3427.      pointer_default(unique)
  3428.  ]
  3429. interface IAMExtTransport : IUnknown {
  3430.  
  3431.     // General transport capabilities property.  See edevdefs.h for enums
  3432.     HRESULT GetCapability(
  3433.         [in] long Capability,       // identify the property
  3434.         [out] long *pValue,         // return value
  3435.         [out] double *pdblValue     // return value
  3436.     );
  3437.  
  3438.     // For disc-based devices: spinning, or not spinning.
  3439.     // For tape-based device: threaded, unthreaded or ejected
  3440.     HRESULT put_MediaState([in] long State
  3441.     );
  3442.     HRESULT get_MediaState([out] long *pState   // see edevdefs.h
  3443.     );
  3444.         
  3445.     // Determines state of unit's front panel
  3446.     HRESULT put_LocalControl([in] long State
  3447.     );
  3448.     HRESULT get_LocalControl([out] long *pState // OATRUE or OAFALSE
  3449.     );
  3450.     
  3451.     // Transport status such as Play, Stop, etc.  More extensive
  3452.     // than AM states.
  3453.     HRESULT GetStatus(
  3454.         [in] long StatusItem,   // see edevdefs.h
  3455.         [out] long *pValue
  3456.     );
  3457.  
  3458.     // Parameters such as recording speed, servo reference, ballistics, etc.
  3459.     HRESULT GetTransportBasicParameters(
  3460.         [in] long Param,
  3461.         [out] long *pValue,
  3462.         [out] LPOLESTR *ppszData
  3463.     );
  3464.  
  3465.     HRESULT SetTransportBasicParameters(
  3466.         [in] long Param,
  3467.         [in] long Value,
  3468.         [in] LPCOLESTR pszData
  3469.     );
  3470.     
  3471.     // Parameters such as video output mode
  3472.     HRESULT GetTransportVideoParameters(
  3473.         [in] long Param,
  3474.         [out] long *pValue
  3475.     );
  3476.  
  3477.     HRESULT SetTransportVideoParameters(
  3478.         [in] long Param,
  3479.         [in] long Value
  3480.     );
  3481.  
  3482.     // Parameters such as audio channel enable
  3483.     HRESULT GetTransportAudioParameters(
  3484.         [in] long Param,
  3485.         [out] long *pValue
  3486.     );
  3487.  
  3488.     HRESULT SetTransportAudioParameters(
  3489.         [in] long Param,
  3490.         [in] long Value
  3491.     );
  3492.     
  3493.     // Mode is  the movement of the transport, i.e., Play, Stop,
  3494.     // Record, Edit, etc.
  3495.     HRESULT put_Mode([in] long Mode
  3496.     );
  3497.     HRESULT get_Mode([out] long *pMode
  3498.     );
  3499.  
  3500.     // Rate is for variable speed control of the the device.  This
  3501.     // can be linked to IMediaControl::Rate() in the implementation
  3502.     // if desired.
  3503.     HRESULT put_Rate([in] double dblRate
  3504.     );
  3505.     HRESULT get_Rate([out] double *pdblRate
  3506.     );
  3507.  
  3508.     // This is a lengthy method, that is, it is in effect until canceled or complete and
  3509.     // requires housekeeping by the filter.  It puts transport in play mode and maintains
  3510.     // fixed relationship between master time reference and transport position.
  3511.     HRESULT GetChase(
  3512.         [out] long *pEnabled,   // OATRUE | OAFALSE
  3513.         [out] long *pOffset,    // offset in current time format
  3514.         [out] HEVENT *phEvent   // completion notification
  3515.     );
  3516.     HRESULT SetChase(
  3517.         [in] long Enable,       // OATRUE | OAFALSE
  3518.         [in] long Offset,       // offset in current time format
  3519.         [in] HEVENT hEvent      // completion notification
  3520.     );
  3521.  
  3522.     // Also a lengthy method: temporarily change transport speed (for synchronizing).
  3523.     HRESULT GetBump(
  3524.         [out] long *pSpeed,
  3525.         [out] long *pDuration   // in current time format
  3526.     );
  3527.     HRESULT SetBump(
  3528.         [in] long Speed,
  3529.         [in] long Duration  // in current time format
  3530.     );
  3531.     
  3532.     // Enable/Disable transport anti-headclog control.
  3533.     HRESULT get_AntiClogControl([out] long *pEnabled    // OATRUE | OAFALSE
  3534.     );
  3535.     HRESULT put_AntiClogControl([in] long Enable    // OATRUE | OAFALSE
  3536.     );
  3537.     
  3538.     // The following group of properties describes edit events.  An edit event can be a
  3539.     // standard insert or assemble edit or a memorized position called a bookmark.
  3540.     // A NOTE ABOUT EVENTS: as with all lengthy commands, event objects must be created to
  3541.     // signal completion or error.
  3542.  
  3543.     // Intended usage: an edit event is prepared for use by:
  3544.     // 1. Registering an edit property set and getting an EditID
  3545.     // 2. Setting the necessary edit properties
  3546.     // 3. Setting the edit property set active
  3547.  
  3548.     // Please see edevdefs.h for properties and values
  3549.  
  3550.     // The reference clock's advance is the mechanism that puts an edit in motion (see
  3551.     // ED_EDIT_REC_INPOINT).
  3552.     
  3553.     // Property set methods
  3554.     HRESULT GetEditPropertySet(
  3555.         [in] long EditID,
  3556.         [out] long *pState  // ED_SET_ACTIVE | ED_SET_INACTIVE | ED_SET_INVALID
  3557.                             // | ED_SET_EXECUTING
  3558.     );
  3559.  
  3560.     HRESULT SetEditPropertySet(
  3561.         [in, out] long *pEditID,
  3562.         [in] long State     // ED_SET_REGISTER | ED_SET_DELETE | ED_SET_ACTIVE |
  3563.     );                      // ED_SET_INACTIVE
  3564.  
  3565.     // the following properties define an edit event such as a bookmark, seek point, or
  3566.     //  actual edit
  3567.     HRESULT GetEditProperty(
  3568.         [in] long EditID,
  3569.         [in] long Param,
  3570.         [out] long *pValue
  3571.     );
  3572.     HRESULT SetEditProperty(
  3573.         [in] long EditID,
  3574.         [in] long Param,
  3575.         [in] long Value
  3576.     );
  3577.     
  3578.     // Activates a capable transport's edit control (typically used for "on the fly" editing).
  3579.     HRESULT get_EditStart([out] long *pValue    // OATRUE or OAFALSE
  3580.     );
  3581.     HRESULT put_EditStart([in] long Value           // OATRUE or OAFALSE
  3582.     );
  3583. }
  3584. typedef IAMExtTransport *PIAMEXTTRANSPORT;
  3585.  
  3586.    //---------------------------------------------------------------------
  3587.    // Defines IAMTimecodeReader Interface
  3588.    //
  3589.    // Contains properties and methods that define behavior of a
  3590.    // SMPTE/MIDI Timecode Reader.  It is expected that this interface
  3591.    // will be combined (aggregated) with IAMExtTransport to "build" a pro
  3592.    // VCR.
  3593.    //
  3594.    // Implement if: you control such a device
  3595.    //
  3596.    // Use if: you want to control such a device
  3597.    //
  3598.    // See edevdefs.h for the parameter lists
  3599.    //=====================================================================
  3600.  
  3601.  
  3602. // timecode structures
  3603. cpp_quote("#if 0")
  3604. cpp_quote("/* the following is what MIDL knows how to remote */")
  3605. typedef struct tagTIMECODE {
  3606.         WORD    wFrameRate; // will be replaced by AM defs, but see ED_FORMAT_SMPTE for now
  3607.         WORD    wFrameFract;    // fractional frame.  full scale is always 0x1000
  3608.         DWORD   dwFrames;
  3609. }TIMECODE;
  3610. cpp_quote("#else /* 0 */")
  3611. cpp_quote("#ifndef TIMECODE_DEFINED")
  3612. cpp_quote("#define TIMECODE_DEFINED")
  3613. cpp_quote("typedef union _timecode {")
  3614. cpp_quote("   struct {")
  3615. cpp_quote("  WORD   wFrameRate;")
  3616. cpp_quote("  WORD   wFrameFract;")
  3617. cpp_quote("  DWORD  dwFrames;")
  3618. cpp_quote("  };")
  3619. cpp_quote("   DWORDLONG  qw;")
  3620. cpp_quote("   } TIMECODE;")
  3621. cpp_quote("")
  3622. cpp_quote("#endif /* TIMECODE_DEFINED */")
  3623. cpp_quote("#endif /* 0 */")
  3624.  
  3625. typedef TIMECODE *PTIMECODE;
  3626.  
  3627. typedef struct tagTIMECODE_SAMPLE {
  3628.     LONGLONG    qwTick;     // ActiveMovie 100ns timestamp
  3629.     TIMECODE    timecode;   // timecode
  3630.     DWORD       dwUser;     // timecode user data (aka user bits)
  3631.     DWORD       dwFlags;       // timecode flags - see below
  3632. } TIMECODE_SAMPLE;
  3633. typedef TIMECODE_SAMPLE *PTIMECODE_SAMPLE;
  3634.  
  3635.  
  3636. [
  3637.     object,
  3638.      uuid(9B496CE1-811B-11cf-8C77-00AA006B6814),
  3639.      pointer_default(unique)
  3640. ]
  3641. interface IAMTimecodeReader : IUnknown
  3642. {
  3643.     // Timecode Reader Mode - gets/sets the following properties
  3644.     // ED_TCR_SOURCE - timecode gen (readback), LTC, VITC, or Control Track
  3645.     HRESULT GetTCRMode(
  3646.         [in] long Param,
  3647.         [out] long *pValue);
  3648.     HRESULT SetTCRMode(
  3649.         [in] long Param,
  3650.         [in] long Value);
  3651.     
  3652.     // Select which line of the vertical interval timecode will be read from (if VITC).
  3653.     // To read VITC on specific multiple lines, the caller would make successive calls to
  3654.     // put_VITCLine(), once for each line desired.
  3655.     HRESULT put_VITCLine(
  3656.         [in] long Line );   // valid lines are 11-20, 0 means autoselect,
  3657.                             // hi bit set means add to list of lines (for
  3658.                             // readers that test across multiple lines)
  3659.     HRESULT get_VITCLine(
  3660.         [out] long *pLine ); // hi bit set means multiple lines are used,
  3661.                             // and successive calls will cycle through the
  3662.                             // line numbers (like an enumerator, only simpler)
  3663.  
  3664.     // GetTimecode can be used to obtain the most recent timecode value available in the
  3665.     // stream. The client can use this to monitor the timecode, parse duplicates and
  3666.     // discontinuities. The source filter supplying the timecode or possibly a down stream
  3667.     // filter might want to parse for discontinuities or errors since you have to look at
  3668.     // every sample to do this properly.
  3669.     //
  3670.  
  3671.     HRESULT GetTimecode(
  3672.       [out] PTIMECODE_SAMPLE pTimecodeSample) ;
  3673.  
  3674. }
  3675. typedef IAMTimecodeReader *PIAMTIMECODEREADER;
  3676.  
  3677.    //---------------------------------------------------------------------
  3678.    //=====================================================================
  3679.    // Defines IAMTimecodeGenerator Interface
  3680.    //
  3681.    // Contains properties and methods that define behavior of an external
  3682.    // SMPTE/MIDI Timecode Generator.  It is expected that this interface
  3683.    // will be combined (aggregated) with IAMExtTransport to "build" a pro
  3684.    // VCR.
  3685.    //
  3686.    // Implement if: you control such a device
  3687.    //
  3688.    // Use if: you want to control such a device
  3689.    //
  3690.    // See edevdefs.h for the parameter lists
  3691.     //---------------------------------------------------------------------
  3692. [
  3693.     object,
  3694.      uuid(9B496CE0-811B-11cf-8C77-00AA006B6814),
  3695.      pointer_default(unique)
  3696.  ]
  3697. interface IAMTimecodeGenerator : IUnknown {
  3698.  
  3699.     // Timecode Generator Mode - gets/sets the following properties (see
  3700.     // vcrdefss.h for detailed values):
  3701.     // ED_TCG_TIMECODE_TYPE - LTC, VITC, or MIDI
  3702.     // ED_TCG_FRAMERATE - 24, 25, 30 drop or 30 nondrop
  3703.     // ED_TCG_SYNC_SOURCE - what is driving the bitclock
  3704.     // ED_TCG_REFERENCE_SOURCE - what is driving the count value
  3705.     HRESULT GetTCGMode(
  3706.         [in] long Param,
  3707.         [out] long *pValue);
  3708.  
  3709.     HRESULT SetTCGMode(
  3710.         [in] long Param,
  3711.         [in] long Value);
  3712.  
  3713.     // Select into which line(s) of the vertical interval timecode will be inserted (if VITC).
  3714.     // Hi bit set means add this line to any previously set lines.
  3715.     // To generate VITC on specific multiple lines, the caller would make successive calls to
  3716.     // put_VITCLine(), once for each line desired.
  3717.     HRESULT put_VITCLine(
  3718.         [in] long Line      // valid lines are 11-20, 0 means autoselect(this setting
  3719.     );                      // is for TC readers that decode from multiple lines)
  3720.     HRESULT get_VITCLine(
  3721.         [out] long *pLine
  3722.     );
  3723.  
  3724.     // Sets timecode and/or userbit value.  If generator is running, takes effect
  3725.     // immediately.  If caller wants to set only timecode, set userbit value to -1L (and
  3726.     // same for setting userbits only)
  3727.     //
  3728.  
  3729.     HRESULT SetTimecode(
  3730.       [in] PTIMECODE_SAMPLE pTimecodeSample) ;
  3731.  
  3732.  
  3733.     // GetTimecode can be used to obtain the most recent timecode value available in the
  3734.     // stream. The client can use this to monitor the timecode and verify the generator is
  3735.     // working properly
  3736.     //
  3737.  
  3738.     HRESULT GetTimecode(
  3739.       [out] PTIMECODE_SAMPLE pTimecodeSample) ;
  3740.  
  3741. }
  3742. typedef IAMTimecodeGenerator *PIAMTIMECODEGENERATOR;
  3743.  
  3744.     //---------------------------------------------------------------------
  3745.    // Defines IAMTimecodeDisplay Interface
  3746.    //
  3747.    // Contains properties and methods that define behavior of an external
  3748.    // SMPTE/MIDI Timecode Display device (aka "character generator" for
  3749.    // making "burn-ins" or "window dubs"). It is expected that this interface
  3750.    // will be combined (aggregated) with IAMExtTransport and the timecode
  3751.    // interfaces to "build" a pro VCR.
  3752.    //
  3753.    // Implement if: you control such a device
  3754.    //
  3755.    // Use if: you want to control such a device
  3756.    //
  3757.    // See edevdefs.h for the parameter lists
  3758.     //---------------------------------------------------------------------
  3759. [
  3760.     object,
  3761.      uuid(9B496CE2-811B-11cf-8C77-00AA006B6814),
  3762.      pointer_default(unique)
  3763.  ]
  3764. interface IAMTimecodeDisplay : IUnknown
  3765. {
  3766.     // Enable/disable external device's timecode reader's character generator output.  Some
  3767.     // readers have this feature - this is not intended for rendering inside the PC!
  3768.     HRESULT GetTCDisplayEnable(
  3769.         [out] long *pState);    // OATRUE | OAFALSE
  3770.     HRESULT SetTCDisplayEnable(
  3771.         [in] long State);       // OATRUE | OAFALSE
  3772.                                 // Timecode reader's character generator output
  3773.                                 //  characteristics (size, position, intensity, etc.).
  3774.     HRESULT GetTCDisplay(
  3775.         [in] long Param,
  3776.         [out] long *pValue);
  3777.     HRESULT SetTCDisplay(
  3778.         [in] long Param,
  3779.         [in] long Value);
  3780.  
  3781.     /* Allowable params and values (see edevdefs.h for details):
  3782.         ED_TCD_SOURCE
  3783.             ED_TCR | ED_TCG
  3784.         ED_TCD_SIZE
  3785.             ED_SMALL | ED_MED | ED_LARGE
  3786.         ED_TCD_POSITION
  3787.             ED_TOP | ED_MIDDLE | ED_BOTTOM or'd  with
  3788.             ED_LEFT | ED_CENTER | ED_RIGHT
  3789.         ED_TCD_INTENSITY
  3790.             ED_HIGH | ED_LOW
  3791.         ED_TCD_TRANSPARENCY // set from 0 to 4, 0 being completely opaque
  3792.         ED_TCD_INVERT       // white on black or black on white
  3793.             OATRUE | OAFALSE
  3794.         ED_TCD_BORDER       // white border for black chars, black border for white letters
  3795.             OATRUE | OAFALSE
  3796.     */
  3797. }
  3798. typedef IAMTimecodeDisplay *PIAMTIMECODEDISPLAY;
  3799.  
  3800.  
  3801. [
  3802.     object,
  3803.     uuid(c6545bf0-e76b-11d0-bd52-00a0c911ce86),
  3804.     pointer_default(unique)
  3805. ]
  3806. interface IAMDevMemoryAllocator : IUnknown
  3807. {
  3808.     HRESULT GetInfo(
  3809.         [out] DWORD *pdwcbTotalFree,
  3810.         [out] DWORD *pdwcbLargestFree,
  3811.         [out] DWORD *pdwcbTotalMemory,
  3812.         [out] DWORD *pdwcbMinimumChunk);
  3813.  
  3814.     HRESULT CheckMemory(
  3815.         [in] const BYTE *pBuffer);
  3816.  
  3817.     HRESULT Alloc(
  3818.         [out] BYTE **ppBuffer,
  3819.         [in, out] DWORD *pdwcbBuffer);
  3820.  
  3821.     HRESULT Free(
  3822.         [in] BYTE *pBuffer);
  3823.  
  3824.     HRESULT GetDevMemoryObject(
  3825.         [out] IUnknown **ppUnkInnner,
  3826.         [in] IUnknown *pUnkOuter);
  3827. }
  3828. typedef IAMDevMemoryAllocator *PAMDEVMEMORYALLOCATOR;
  3829.  
  3830.  
  3831. [
  3832.     object,
  3833.     uuid(c6545bf1-e76b-11d0-bd52-00a0c911ce86),
  3834.     pointer_default(unique)
  3835. ]
  3836. interface IAMDevMemoryControl : IUnknown
  3837. {
  3838.     HRESULT QueryWriteSync();
  3839.  
  3840.     HRESULT WriteSync();
  3841.  
  3842.     HRESULT GetDevId(
  3843.         [out] DWORD *pdwDevId);
  3844.  
  3845. }
  3846. typedef IAMDevMemoryControl *PAMDEVMEMORYCONTROL;
  3847.  
  3848. //  Flags for IAMStreamSelection::Info
  3849. enum _AMSTREAMSELECTINFOFLAGS {
  3850.     AMSTREAMSELECTINFO_ENABLED   = 0x01,  // Enable - off for disable
  3851.     AMSTREAMSELECTINFO_EXCLUSIVE = 0x02   // Turns off the others in the group
  3852.                                           // when enabling this one
  3853. };
  3854. //  Flags for IAMStreamSelection::Enable
  3855. enum _AMSTREAMSELECTENABLEFLAGS {
  3856.     //  Currently valid values are :
  3857.     //  0 - disable all streams in the group containing this stream
  3858.     //  ..._ENABLE - enable only this stream with in the given group
  3859.     //               and disable all others
  3860.     //  ..._ENABLEALL - send out all streams
  3861.     AMSTREAMSELECTENABLE_ENABLE    = 0x01,  // Enable
  3862.     AMSTREAMSELECTENABLE_ENABLEALL = 0x02   // Enable all streams in the group
  3863.                                             // containing this stream
  3864. };
  3865.  
  3866. //  Control which logical streams are played and find out information about
  3867. //  them
  3868. //  Normally supported by a filter
  3869. [
  3870.     object,
  3871.     uuid(c1960960-17f5-11d1-abe1-00a0c905f375),
  3872.     pointer_default(unique)
  3873. ]
  3874. interface IAMStreamSelect : IUnknown
  3875. {
  3876.     //  Returns total count of streams
  3877.     HRESULT Count(
  3878.         [out] DWORD *pcStreams);      // Count of logical streams
  3879.  
  3880.     //  Return info for a given stream - S_FALSE if iIndex out of range
  3881.     //  The first steam in each group is the default
  3882.     HRESULT Info(
  3883.         [in] long lIndex,              // 0-based index
  3884.         [out] AM_MEDIA_TYPE **ppmt,   // Media type - optional
  3885.                                       // Use DeleteMediaType to free
  3886.         [out] DWORD *pdwFlags,        // flags - optional
  3887.         [out] LCID  *plcid,           // LCID (returns 0 if none) - optional
  3888.         [out] DWORD *pdwGroup,        // Logical group - optional
  3889.         [out] WCHAR **ppszName,       // Name - optional - free with CoTaskMemFree
  3890.                                       // optional
  3891.         [out] IUnknown **ppObject,    // Associated object - optional
  3892.                                       // Object may change if Enable is
  3893.                                       // called on this interface
  3894.                                       // - returns NULL if no associated object
  3895.                                       // Returns pin or filter for DShow
  3896.         [out] IUnknown **ppUnk);      // Stream specific interface
  3897.  
  3898.     //  Enable or disable a given stream
  3899.     HRESULT Enable(
  3900.         [in]  long lIndex,
  3901.         [in]  DWORD dwFlags);
  3902. }
  3903. typedef IAMStreamSelect *PAMSTREAMSELECT;
  3904.  
  3905. enum _AMRESCTL_RESERVEFLAGS
  3906. {
  3907.     AMRESCTL_RESERVEFLAGS_RESERVE     = 0x00,  // Increment reserve count
  3908.     AMRESCTL_RESERVEFLAGS_UNRESERVE   = 0x01   // Decrement reserve count
  3909. };
  3910.  
  3911. //  Reserve resources now so that playback can be subsequently
  3912. //  guaranteed
  3913. //
  3914. //  Normally supported by a filter
  3915. //
  3916. [
  3917.     object,
  3918.     uuid(8389d2d0-77d7-11d1-abe6-00a0c905f375),
  3919.     pointer_default(unique),
  3920.     local
  3921. ]
  3922. interface IAMResourceControl : IUnknown
  3923. {
  3924.     //  The reserve count is incremented/decremented if and only if
  3925.     //  S_OK is returned
  3926.     //  Unreserve once for every Reserve call
  3927.     HRESULT Reserve(
  3928.         [in] DWORD dwFlags,          //  From _AMRESCTL_RESERVEFLAGS enum
  3929.         [in] PVOID pvReserved        //  Must be NULL
  3930.     );
  3931. }
  3932.  
  3933.  
  3934. //  Set clock adjustments - supported by some clocks
  3935. [
  3936.     object,
  3937.     uuid(4d5466b0-a49c-11d1-abe8-00a0c905f375),
  3938.     pointer_default(unique),
  3939.     local
  3940. ]
  3941. interface IAMClockAdjust : IUnknown
  3942. {
  3943.     //  Set the following delta to clock times
  3944.     //  The clock will add adjust its times by the given delta
  3945.     HRESULT SetClockDelta(
  3946.         [in] REFERENCE_TIME rtDelta
  3947.     );
  3948. };
  3949.  
  3950. //  Filter miscellaneous status flags
  3951.  
  3952. enum _AM_FILTER_MISC_FLAGS {
  3953.     AM_FILTER_MISC_FLAGS_IS_RENDERER = 0x00000001, /* Will deliver EC_COMPLETE
  3954.                                                      at end of media */
  3955.     AM_FILTER_MISC_FLAGS_IS_SOURCE   = 0x00000002  /*  Filter sources data */
  3956. };
  3957.  
  3958. [
  3959.     object,
  3960.     uuid(2dd74950-a890-11d1-abe8-00a0c905f375),
  3961.     pointer_default(unique),
  3962.     local
  3963. ]
  3964. interface IAMFilterMiscFlags : IUnknown
  3965. {
  3966.     //  Get miscellaneous property flags
  3967.     ULONG GetMiscFlags(void);
  3968. };
  3969.  
  3970.  
  3971. // Video Image drawing interface
  3972. [
  3973.     object,
  3974.     local,
  3975.     uuid(48efb120-ab49-11d2-aed2-00a0c995e8d5),
  3976.     pointer_default(unique),
  3977. ]
  3978. interface IDrawVideoImage : IUnknown
  3979. {
  3980.     HRESULT DrawVideoImageBegin();
  3981.  
  3982.     HRESULT DrawVideoImageEnd();
  3983.  
  3984.     HRESULT DrawVideoImageDraw(
  3985.         [in] HDC hdc,
  3986.         [in] LPRECT lprcSrc,
  3987.         [in] LPRECT lprcDst
  3988.     );
  3989. }
  3990.  
  3991. //
  3992. // Video Image decimation interface
  3993. //
  3994. // The aim of this interface is to enable a video renderer filter to
  3995. // control the decimation properties of a video decoder connected to
  3996. // the video renderer
  3997. //
  3998. // This interface should only be supported by decoders that are capable of
  3999. // decimating their output image by an arbitary amount.
  4000. //
  4001. //
  4002. [
  4003.     object,
  4004.     local,
  4005.     uuid(2e5ea3e0-e924-11d2-b6da-00a0c995e8df),
  4006.     pointer_default(unique),
  4007. ]
  4008. interface IDecimateVideoImage : IUnknown
  4009. {
  4010.     //
  4011.     // Informs the decoder that it should decimate its output
  4012.     // image to the specified width and height.  If the decoder can
  4013.     // decimate to this size it should return S_OK.
  4014.     // If the decoder can't perform the requested decimation
  4015.     // or wants to stop performing the decimation that it is
  4016.     // currently doing it should return E_FAIL.
  4017.     //
  4018.     HRESULT SetDecimationImageSize(
  4019.         [in] long lWidth,
  4020.         [in] long lHeight);
  4021.  
  4022.     //
  4023.     // Informs the decoder that it should stop decimating its output image
  4024.     // and resume normal output.
  4025.     //
  4026.     HRESULT ResetDecimationImageSize();
  4027. }
  4028.  
  4029. typedef enum _DECIMATION_USAGE {
  4030.     DECIMATION_LEGACY,              // decimate at ovly then video port then crop
  4031.     DECIMATION_USE_DECODER_ONLY,    // decimate image at the decoder only
  4032.     DECIMATION_USE_VIDEOPORT_ONLY,  // decimate at the video port only
  4033.     DECIMATION_USE_OVERLAY_ONLY,    // decimate at the overlay only
  4034.     DECIMATION_DEFAULT              // decimate at decoder then ovly the vide port then crop
  4035. } DECIMATION_USAGE;
  4036.  
  4037. [
  4038.     object,
  4039.     local,
  4040.     uuid(60d32930-13da-11d3-9ec6-c4fcaef5c7be),
  4041.     pointer_default(unique),
  4042. ]
  4043. interface IAMVideoDecimationProperties: IUnknown
  4044. {
  4045.     //
  4046.     // Queries the current usage of the above IDecimateVideoImage
  4047.     // interface.
  4048.     //
  4049.     HRESULT QueryDecimationUsage(
  4050.         [out] DECIMATION_USAGE* lpUsage);       // from DECIMATION_USAGE enum
  4051.  
  4052.     //
  4053.     // Sets the current usage of the above IDecimateVideoImage
  4054.     // interface.
  4055.     //
  4056.     HRESULT SetDecimationUsage(
  4057.         [in] DECIMATION_USAGE Usage);           // from DECIMATION_USAGE enum
  4058. }
  4059.  
  4060. //---------------------------------------------------------------------
  4061. //
  4062. // IVideoFrameStep interface
  4063. //
  4064. //---------------------------------------------------------------------
  4065.  
  4066. [
  4067.     object,
  4068.     uuid(e46a9787-2b71-444d-a4b5-1fab7b708d6a),
  4069.     pointer_default(unique),
  4070. ]
  4071. interface IVideoFrameStep : IUnknown
  4072. {
  4073.     //
  4074.     //  Stop(), Pause(), Run() all cancel Step as does any seeking
  4075.     //  request.
  4076.     //
  4077.     //  The Step() and CancelStep() methods of this interface
  4078.     //  Cancel any previous step.
  4079.     //
  4080.     //  When stepping is complete EC_STEP_COMPLETE is signalled.
  4081.     //
  4082.     //  When the filter graph gets EC_STEP_COMPLETE it automatically
  4083.     //  sets the filter graph into paused state and forwards the
  4084.     //  notification to the application
  4085.     //
  4086.     //  Returns S_OK if stepping initiated.
  4087.     //
  4088.     //  dwFrames
  4089.     //    1 means step 1 frame forward
  4090.     //    0 is invalid
  4091.     //    n (n > 1) means skip n - 1 frames and show the nth
  4092.     //
  4093.     //  pStepObject
  4094.     //    NULL - default step object (filter) picked
  4095.     //    non-NULL - use this object for stepping
  4096.     //
  4097.     HRESULT Step(DWORD dwFrames, [unique] IUnknown *pStepObject);
  4098.  
  4099.     //  Can step?
  4100.     //  Returns S_OK if it can, S_FALSE if it can't or error code.
  4101.     //  bMultiple - if TRUE return whether can step n > 1
  4102.     HRESULT CanStep(long bMultiple, [unique] IUnknown *pStepObject);
  4103.  
  4104.     //  Cancel stepping
  4105.     HRESULT CancelStep();
  4106. }
  4107.  
  4108.  
  4109.  
  4110.  
  4111. //---------------------------------------------------------------------
  4112. //
  4113. // IAMPushSource interface
  4114. //
  4115. // Provides a means for source filters to describe information about the
  4116. // data that they source, such as whether the data is live or not, and
  4117. // what type of clock was used for timestamps. This information may be
  4118. // needed by other clocks in the graph in order to provide accurate
  4119. // synchronization. Also provides a way to specify an offset value for
  4120. // the filter to use when timestamping the streams it sources. Provides
  4121. // support for the IAMLatency interface as well.
  4122. //
  4123. //---------------------------------------------------------------------
  4124.  
  4125. enum _AM_PUSHSOURCE_FLAGS {
  4126.  
  4127.     //
  4128.     // The default assumption is that the data is from a live source,
  4129.     // time stamped with the graph clock, and the source does not
  4130.     // attempt to rate match the data it delivers.
  4131.     // The following flags can be used to override this assumption.
  4132.     //
  4133.  
  4134.     // capability flags
  4135.     AM_PUSHSOURCECAPS_INTERNAL_RM        = 0x00000001,  // source provides internal support for rate matching
  4136.     AM_PUSHSOURCECAPS_NOT_LIVE           = 0x00000002,  // don't treat source data as live
  4137.     AM_PUSHSOURCECAPS_PRIVATE_CLOCK      = 0x00000004,  // source data timestamped with clock not
  4138.                                                         // exposed to the graph
  4139.  
  4140.     // request flags, set by user via SetPushSourceFlags method
  4141.     AM_PUSHSOURCEREQS_USE_STREAM_CLOCK   = 0x00010000   // source was requested to timestamp
  4142.                                                         // using a clock that isn't the graph clock
  4143. };
  4144.  
  4145. //
  4146. // Used to set a source filter to run in a "live" mode.
  4147. //
  4148. [
  4149. object,
  4150.     uuid(F185FE76-E64E-11d2-B76E-00C04FB6BD3D),
  4151.     pointer_default(unique)
  4152. ]
  4153. interface IAMPushSource : IAMLatency
  4154. {
  4155.     // used to discover push source's capabilities.
  4156.     // may be any combination of the AM_PUSHSOURCE_FLAGS flags.
  4157.     HRESULT GetPushSourceFlags (
  4158.         [out] ULONG *pFlags
  4159.     );
  4160.  
  4161.     // used to set request flags for a push source.
  4162.     // may be a combination of the AM_PUSHSOURCE_REQS_xxx flags.
  4163.     HRESULT SetPushSourceFlags (
  4164.         [in]  ULONG Flags
  4165.     );
  4166.  
  4167.     // specify an offset for push source time stamps
  4168.     HRESULT SetStreamOffset (
  4169.         [in]  REFERENCE_TIME  rtOffset
  4170.     );
  4171.  
  4172.     // retrieve the offset this push source is using
  4173.     HRESULT GetStreamOffset (
  4174.         [out] REFERENCE_TIME  *prtOffset
  4175.     );
  4176.  
  4177.     // retrieve the maximum stream offset this push source thinks it can support
  4178.     HRESULT GetMaxStreamOffset (
  4179.         [out] REFERENCE_TIME  *prtMaxOffset
  4180.     );
  4181.  
  4182.     // allows the filter graph to tell a push source the maximum latency allowed on the graph
  4183.     // this allows pins like the video capture preview pin to be more efficient with the amount
  4184.     // of buffering required to support the maximum graph latency
  4185.     HRESULT SetMaxStreamOffset (
  4186.         [in] REFERENCE_TIME  rtMaxOffset
  4187.     );
  4188. };
  4189.  
  4190.  
  4191. // ------------------------------------------------------------------------
  4192. //
  4193. // IAMDeviceRemoval interface
  4194. //
  4195. // Implemented by filters to request and receive WM_DEVICECHANGE
  4196. // notifications
  4197. //
  4198. // ------------------------------------------------------------------------
  4199.  
  4200. [
  4201.         object,
  4202.         uuid(f90a6130-b658-11d2-ae49-0000f8754b99),
  4203.         pointer_default(unique)
  4204. ]
  4205. interface IAMDeviceRemoval : IUnknown
  4206. {
  4207.  
  4208.     HRESULT DeviceInfo(
  4209.         [out] CLSID *pclsidInterfaceClass,
  4210.         [out] WCHAR **pwszSymbolicLink);
  4211.  
  4212.     HRESULT Reassociate();
  4213.  
  4214.     HRESULT Disassociate();
  4215. }
  4216.  
  4217. //
  4218. // for DV
  4219. //
  4220. typedef struct {
  4221.     //for 1st 5/6 DIF seq.
  4222.     DWORD dwDVAAuxSrc;
  4223.     DWORD dwDVAAuxCtl;
  4224.     //for 2nd  5/6 DIF seq.
  4225.     DWORD dwDVAAuxSrc1;
  4226.     DWORD dwDVAAuxCtl1;
  4227.     //for video information
  4228.     DWORD dwDVVAuxSrc;
  4229.     DWORD dwDVVAuxCtl;
  4230.     DWORD dwDVReserved[2];
  4231.  
  4232. } DVINFO, *PDVINFO;
  4233.  
  4234. // ------------------------------------------------------------------------
  4235. //
  4236. // IDVEnc interface
  4237. //
  4238. // Implemented by DV encoder filters to set Encoder format
  4239. //
  4240. // ------------------------------------------------------------------------
  4241. enum _DVENCODERRESOLUTION {         //resolution
  4242.     DVENCODERRESOLUTION_720x480     =   2012,
  4243.     DVENCODERRESOLUTION_360x240     =   2013,
  4244.     DVENCODERRESOLUTION_180x120     =   2014,
  4245.     DVENCODERRESOLUTION_88x60       =   2015
  4246. };
  4247. enum _DVENCODERVIDEOFORMAT {        //PAL/ntsc
  4248.     DVENCODERVIDEOFORMAT_NTSC       =   2000,
  4249.     DVENCODERVIDEOFORMAT_PAL        =   2001
  4250. };
  4251. enum _DVENCODERFORMAT {     // dvsd/dvhd/dvsl
  4252.     DVENCODERFORMAT_DVSD        =   2007,
  4253.     DVENCODERFORMAT_DVHD        =   2008,
  4254.     DVENCODERFORMAT_DVSL        =   2009
  4255. };
  4256. [
  4257.         object,
  4258.         uuid(d18e17a0-aacb-11d0-afb0-00aa00b67a42),
  4259.         pointer_default(unique)
  4260. ]
  4261. interface IDVEnc : IUnknown
  4262. {
  4263.  
  4264.     HRESULT get_IFormatResolution (
  4265.         [out] int *VideoFormat, //pal or ntsc
  4266.         [out] int *DVFormat,    //dvsd dvhd dvsl
  4267.         [out] int *Resolution,  //720, 360, 180,88
  4268.         [in]  BYTE fDVInfo,     //TRUE: DVINFO structure exist, FALSE: Do not care DVINFO
  4269.         [out] DVINFO *sDVInfo   //NULL if fDVInfo=FALSE,
  4270.     );
  4271.  
  4272.    HRESULT put_IFormatResolution (
  4273.         [in] int VideoFormat,
  4274.         [in] int DVFormat,
  4275.         [in] int Resolution,    
  4276.         [in] BYTE fDVInfo,      //TRUE: DVINFO structure exist, FALSE: Do not care DVINFO
  4277.         [in] DVINFO *sDVInfo    //NULL if fDVInfo=FALSE,
  4278.     );
  4279.  
  4280. }
  4281.  
  4282. // ------------------------------------------------------------------------
  4283. //
  4284. // IDVDec interface
  4285. //
  4286. // Implemented by DV decoder filters to set decoder size
  4287. //
  4288. // ------------------------------------------------------------------------
  4289. enum _DVDECODERRESOLUTION {
  4290.     DVDECODERRESOLUTION_720x480     =   1000,
  4291.     DVDECODERRESOLUTION_360x240     =   1001,
  4292.     DVDECODERRESOLUTION_180x120     =   1002,
  4293.     DVDECODERRESOLUTION_88x60       =   1003
  4294. };
  4295. enum _DVRESOLUTION {
  4296.     DVRESOLUTION_FULL       =   1000,
  4297.     DVRESOLUTION_HALF       =   1001,
  4298.     DVRESOLUTION_QUARTER    =   1002,
  4299.     DVRESOLUTION_DC         =   1003
  4300. };
  4301. [
  4302.         object,
  4303.         uuid(b8e8bd60-0bfe-11d0-af91-00aa00b67a42),
  4304.         pointer_default(unique)
  4305. ]
  4306. interface IIPDVDec : IUnknown
  4307. {
  4308.     HRESULT get_IPDisplay (
  4309.             [out] int *displayPix       // The display pixels arrage
  4310.                  );
  4311.  
  4312.     HRESULT put_IPDisplay (
  4313.              [in] int displayPix        // Change to this display pixel arrage
  4314.                  ) ;
  4315. }
  4316.  
  4317. //------------------------------------------------------------------------
  4318. //
  4319. // IDVRGB219 interface
  4320. //
  4321. // Implemented by both the DV encoder and decoder filters
  4322. // Used for enabling the 219 mode in which the Range of RGB24 either received
  4323. // by the encoder or produced by the decoder becomes (16,16,16)--(235,235,235)
  4324. // instead of (0,0,0)--(255,255,255).
  4325. // The interface's method has no effect in case of any other color space than
  4326. // RGB 24
  4327. //
  4328. //------------------------------------------------------------------------
  4329.  
  4330. [
  4331.         object,
  4332.         uuid(58473A19-2BC8-4663-8012-25F81BABDDD1),
  4333.         pointer_default(unique)
  4334. ]
  4335. interface IDVRGB219 : IUnknown
  4336. {
  4337.     HRESULT SetRGB219 ([in] BOOL bState);   // State = True   Turn 219 mode on else turn it off.
  4338. }
  4339.  
  4340.  
  4341. // ------------------------------------------------------------------------
  4342. //
  4343. // IDVSplitter interface
  4344. //
  4345. // Implemented by DV splitter filters
  4346. //
  4347. // ------------------------------------------------------------------------
  4348. [
  4349.     object,
  4350.     uuid(92a3a302-da7c-4a1f-ba7e-1802bb5d2d02)
  4351. ]
  4352. interface IDVSplitter : IUnknown
  4353. {
  4354.     HRESULT DiscardAlternateVideoFrames(
  4355.             [in] int nDiscard
  4356.                  ) ;
  4357. }
  4358.  
  4359. //  Audio Renderer statistics params for IAMAudioRendererStats interface
  4360. enum _AM_AUDIO_RENDERER_STAT_PARAM {
  4361.     AM_AUDREND_STAT_PARAM_BREAK_COUNT = 1,     // audio breaks
  4362.     AM_AUDREND_STAT_PARAM_SLAVE_MODE,          // current slave mode, see AM_AUDREND_SLAVE_MODEs
  4363.     AM_AUDREND_STAT_PARAM_SILENCE_DUR,         // silence inserted due to gaps (ms)
  4364.     AM_AUDREND_STAT_PARAM_LAST_BUFFER_DUR,     // duration of the last buffer received
  4365.     AM_AUDREND_STAT_PARAM_DISCONTINUITIES,     // discontinuities seen since running
  4366.     AM_AUDREND_STAT_PARAM_SLAVE_RATE,          // what rate are we currently slaving at? S_FALSE if not slaving
  4367.     AM_AUDREND_STAT_PARAM_SLAVE_DROPWRITE_DUR, // for waveOut slaving - data dropped or added to stay in-sync
  4368.                                                //       dwParam1 - dropped duration(ms)
  4369.                                                //       dwParam2 - paused duration(ms)
  4370.     AM_AUDREND_STAT_PARAM_SLAVE_HIGHLOWERROR,  // highest & lowest clock differences seen
  4371.                                                //       dwParam1 - high err
  4372.                                                //       dwParam2 - low err
  4373.     AM_AUDREND_STAT_PARAM_SLAVE_LASTHIGHLOWERROR, // last high and low errs seen
  4374.                                                //       dwParam1 - last high err
  4375.                                                //       dwParam2 - last low err
  4376.     AM_AUDREND_STAT_PARAM_SLAVE_ACCUMERROR,    // error between master/slave clocks
  4377.     AM_AUDREND_STAT_PARAM_BUFFERFULLNESS,      // percent audio buffer fullness
  4378.     AM_AUDREND_STAT_PARAM_JITTER               // input buffer jitter
  4379. };
  4380.  
  4381. //---------------------------------------------------------------------
  4382. //
  4383. // IAMAudioRendererStats interface
  4384. //
  4385. // Interface to get at statistical information that is optionally stored
  4386. // in an audio renderer filter. Supported on the filter interface (although
  4387. // this might be better for ksproxy if we define it as a pin interface?)
  4388. //
  4389. //---------------------------------------------------------------------
  4390.  
  4391. [
  4392. object,
  4393.     uuid(22320CB2-D41A-11d2-BF7C-D7CB9DF0BF93),
  4394.     pointer_default(unique)
  4395. ]
  4396. interface IAMAudioRendererStats : IUnknown
  4397. {
  4398.     // Get value corresponding to the passed in parameter id
  4399.     HRESULT GetStatParam(
  4400.         [in]   DWORD     dwParam,
  4401.         [out]  DWORD     *pdwParam1,
  4402.         [out]  DWORD     *pdwParam2
  4403.     );
  4404. }
  4405.  
  4406. //---------------------------------------------------------------------
  4407. //
  4408. // IAMLatency interface
  4409. //
  4410. // Allows a filter to report the expected latency associated with a data
  4411. // stream flowing from its input to output pin. Supported on output pins.
  4412. //
  4413. //---------------------------------------------------------------------
  4414.  
  4415. [
  4416. object,
  4417.     uuid(62EA93BA-EC62-11d2-B770-00C04FB6BD3D),
  4418.     pointer_default(unique)
  4419. ]
  4420. interface IAMLatency : IUnknown
  4421. {
  4422.     HRESULT GetLatency(
  4423.         [in]   REFERENCE_TIME  *prtLatency
  4424.     );
  4425. }
  4426.  
  4427.  
  4428. enum _AM_INTF_SEARCH_FLAGS {
  4429.     AM_INTF_SEARCH_INPUT_PIN  = 0x00000001,   // search input pins
  4430.     AM_INTF_SEARCH_OUTPUT_PIN = 0x00000002,   // search output pins
  4431.     AM_INTF_SEARCH_FILTER     = 0x00000004    // search filters
  4432. };
  4433.  
  4434. //---------------------------------------------------------------------
  4435. //
  4436. // IAMGraphStreams interface
  4437. //
  4438. // Interface used to control or search over connected streams of data
  4439. // flow within a filter graph.
  4440. //
  4441. //---------------------------------------------------------------------
  4442.  
  4443. [
  4444. object,
  4445.     uuid(632105FA-072E-11d3-8AF9-00C04FB6BD3D),
  4446.     pointer_default(unique)
  4447. ]
  4448. interface IAMGraphStreams : IUnknown
  4449. {
  4450.     // Search upstream from the current pin, for the specified interface.
  4451.     // dwFlags can be any combination of the AM_INTF_SEARCH_FLAGS, and allows
  4452.     // control over what objects to search. A value of 0 means to search all.
  4453.     HRESULT FindUpstreamInterface(
  4454.         [in]                IPin *pPin,
  4455.         [in]                REFIID riid,
  4456.         [out, iid_is(riid)] void **ppvInterface,
  4457.         [in]                DWORD dwFlags );
  4458.  
  4459.     // Enable or disable the graph's setting of a timestamp offset
  4460.     // on push sources.
  4461.     HRESULT SyncUsingStreamOffset( [in] BOOL bUseStreamOffset );
  4462.  
  4463.     // allow an app to set the maximum offset used on push source filters
  4464.     HRESULT SetMaxGraphLatency( [in] REFERENCE_TIME rtMaxGraphLatency );
  4465. }
  4466.  
  4467.  
  4468. //
  4469. // IAMOverlayFX
  4470. //
  4471. // This interface is exposed by the overlay mixer filter and allows
  4472. // an application to apply various "effects" to the overlay surface
  4473. // used by the overlay mixer.
  4474. //
  4475. // The effects that can be applied are described by the AMOVERLAYFX
  4476. // enumeration.
  4477. //
  4478. enum AMOVERLAYFX {
  4479.     // Normal (ie. top down, left to right) video
  4480.     AMOVERFX_NOFX =             0x00000000,
  4481.  
  4482.     // Mirror the overlay across the vertical axis
  4483.     AMOVERFX_MIRRORLEFTRIGHT =  0x00000002,
  4484.  
  4485.      // Mirror the overlay across the horizontal axis
  4486.     AMOVERFX_MIRRORUPDOWN =     0x00000004,
  4487.  
  4488.     // Deinterlace the overlay, if possible
  4489.     AMOVERFX_DEINTERLACE =      0x00000008
  4490. };
  4491.  
  4492. [
  4493. object,
  4494.     uuid(62fae250-7e65-4460-bfc9-6398b322073c),
  4495.     pointer_default(unique)
  4496. ]
  4497. interface IAMOverlayFX : IUnknown
  4498. {
  4499.     // Use this method to determine what overlay effects are currently available
  4500.     // for the overlay surface used by the overlay mixer filter.
  4501.     //
  4502.     HRESULT QueryOverlayFXCaps(
  4503.         [out] DWORD *lpdwOverlayFXCaps
  4504.         );
  4505.  
  4506.     // Use this method to apply a new overlay effect to the overlay surface
  4507.     // used by the overlay mixer filter.  This method can be called while the
  4508.     // filter graph is running, the effect is applied immediately
  4509.     //
  4510.     HRESULT SetOverlayFX(
  4511.         [in] DWORD dwOverlayFX
  4512.         );
  4513.  
  4514.     // Use this method to determine what effect (if any) is currently being
  4515.     // applied to the overlay surface by the overlay mixer filter.
  4516.     //
  4517.     HRESULT GetOverlayFX(
  4518.         [out] DWORD *lpdwOverlayFX
  4519.         );
  4520. }   
  4521.  
  4522.  
  4523.  
  4524. // IAMOpenProgress interface provides information about current progress through
  4525. // a download
  4526.  
  4527. [
  4528. object,
  4529. uuid(8E1C39A1-DE53-11cf-AA63-0080C744528D),
  4530. pointer_default(unique)
  4531. ]
  4532.  
  4533. interface IAMOpenProgress : IUnknown
  4534. {
  4535.     // QueryProgress can be used to query the source filter which supports this interface
  4536.     // for progress information during a renderfile operation.
  4537.     HRESULT QueryProgress(
  4538.           [out] LONGLONG* pllTotal,
  4539.           [out] LONGLONG* pllCurrent
  4540.          );
  4541.  
  4542.     // AbortOperation can be used to request an abort of RenderFile operation
  4543.     // causing it to stop downloading. This methods instructs the exporter of
  4544.     // the IAMOpenProgress interface to hold up their internal abort flag until
  4545.     // further notice.
  4546.     HRESULT AbortOperation(
  4547.         );
  4548. }
  4549.  
  4550.  
  4551. /*++
  4552.     IMpeg2Demultiplexer
  4553.  
  4554.     This interface is implemented by the MPEG-2 Demultiplexer filter,
  4555.     irrespective of program vs. transport stream splitting functionality.
  4556. --*/
  4557. [
  4558.     object,
  4559.     local,
  4560.     uuid (436eee9c-264f-4242-90e1-4e330c107512),
  4561.     pointer_default(unique)
  4562. ]
  4563. interface IMpeg2Demultiplexer : IUnknown
  4564. {
  4565.     /*++
  4566.         ------------------------------------------------------------------------
  4567.         purpose:    Creates an output pin of the specified media type.
  4568.  
  4569.         pMediaType      media type specifier for the new pin
  4570.         pszPinName      pin name; cannot be a duplicate of an existing pin
  4571.         ppIPin          IPin interface pointer to the newly created pin
  4572.     --*/
  4573.     HRESULT
  4574.     CreateOutputPin (
  4575.         [in]    AM_MEDIA_TYPE * pMediaType,
  4576.         [in]    LPWSTR          pszPinName,
  4577.         [out]   IPin **         ppIPin
  4578.         ) ;
  4579.  
  4580.     /*++
  4581.         ------------------------------------------------------------------------
  4582.         purpose:    Updates the media type of the specified output pin.  If no
  4583.                       connection exists, the media type is updated always.  If
  4584.                       the pin is connected, the success/failure of the call will
  4585.                       depend on downstream input pin's accetance/rejection of
  4586.                       the specified media type, and subsequent success/failure
  4587.                       of a reconnect.
  4588.  
  4589.         pszPinName      pin name
  4590.         pMediaType      new media type specifier
  4591.     --*/
  4592.     HRESULT
  4593.     SetOutputPinMediaType (
  4594.         [in]    LPWSTR          pszPinName,
  4595.         [in]    AM_MEDIA_TYPE * pMediaType
  4596.         ) ;
  4597.  
  4598.     /*++
  4599.         ------------------------------------------------------------------------
  4600.         purpose:    Deletes the specified output pin.
  4601.  
  4602.         pszPinName      pin name
  4603.     --*/
  4604.     HRESULT
  4605.     DeleteOutputPin (
  4606.         [in]    LPWSTR  pszPinName
  4607.         ) ;
  4608. } ;
  4609.  
  4610. //---------------------------------------------------------------------
  4611. // IEnumStreamIdMap interface
  4612. //---------------------------------------------------------------------
  4613.  
  4614. cpp_quote("#define MPEG2_PROGRAM_STREAM_MAP                 0x00000000")
  4615. cpp_quote("#define MPEG2_PROGRAM_ELEMENTARY_STREAM          0x00000001")
  4616. cpp_quote("#define MPEG2_PROGRAM_DIRECTORY_PES_PACKET       0x00000002")
  4617. cpp_quote("#define MPEG2_PROGRAM_PACK_HEADER                0x00000003")
  4618. cpp_quote("#define MPEG2_PROGRAM_PES_STREAM                 0x00000004")
  4619. cpp_quote("#define MPEG2_PROGRAM_SYSTEM_HEADER              0x00000005")
  4620.  
  4621. cpp_quote("#define SUBSTREAM_FILTER_VAL_NONE                0x10000000")
  4622.  
  4623. typedef struct {
  4624.     ULONG   stream_id ;                     //  mpeg-2 stream_id
  4625.     DWORD   dwMediaSampleContent ;          //  #define'd above
  4626.     ULONG   ulSubstreamFilterValue ;        //  filtering value
  4627.     int     iDataOffset ;                   //  offset to elementary stream
  4628. } STREAM_ID_MAP ;
  4629.  
  4630. /*++
  4631.     Enumerates the StreamIds mapped on a pin
  4632. --*/
  4633. [
  4634.     object,
  4635.     local,
  4636.     uuid (945C1566-6202-46fc-96C7-D87F289C6534),
  4637.     pointer_default(unique)
  4638. ]
  4639. interface IEnumStreamIdMap : IUnknown
  4640. {
  4641.     HRESULT
  4642.     Next (
  4643.         [in]                            ULONG           cRequest,
  4644.         [in, out, size_is (cRequest)]   STREAM_ID_MAP * pStreamIdMap,
  4645.         [out]                           ULONG *         pcReceived
  4646.         ) ;
  4647.  
  4648.     HRESULT
  4649.     Skip (
  4650.         [in]    ULONG   cRecords
  4651.         ) ;
  4652.  
  4653.     HRESULT
  4654.     Reset (
  4655.         ) ;
  4656.  
  4657.     HRESULT
  4658.     Clone (
  4659.         [out]   IEnumStreamIdMap **  ppIEnumStreamIdMap
  4660.         ) ;
  4661. } ;
  4662.  
  4663. /*++
  4664.     Implemented on the output pin.
  4665.  
  4666.     Provides the ability to map/unmap a stream_id to/from an output pin.
  4667. --*/
  4668. [
  4669.     object,
  4670.     local,
  4671.     uuid (D0E04C47-25B8-4369-925A-362A01D95444),
  4672.     pointer_default(unique)
  4673. ]
  4674. interface IMPEG2StreamIdMap : IUnknown
  4675. {
  4676.     HRESULT
  4677.     MapStreamId (
  4678.         [in]    ULONG   ulStreamId,                 //  mpeg-2 stream_id
  4679.         [in]    DWORD   MediaSampleContent,         //  #define'd above IEnumStreamIdMap
  4680.         [in]    ULONG   ulSubstreamFilterValue,     //  filter value
  4681.         [in]    int     iDataOffset                 //  elementary stream offset
  4682.         ) ;
  4683.  
  4684.     HRESULT
  4685.     UnmapStreamId (
  4686.         [in]    ULONG   culStreamId,                //  number of stream_id's in pulStreamId
  4687.         [in]    ULONG * pulStreamId                 //  array of stream_id's to unmap
  4688.         ) ;
  4689.  
  4690.     HRESULT
  4691.     EnumStreamIdMap (
  4692.         [out]   IEnumStreamIdMap ** ppIEnumStreamIdMap
  4693.         ) ;
  4694. } ;
  4695.  
  4696.  
  4697. //  Register a service provider with the filter graph
  4698. [
  4699.         object,
  4700.         local,
  4701.         uuid(7B3A2F01-0751-48DD-B556-004785171C54),
  4702.         pointer_default(unique)
  4703. ]
  4704. interface IRegisterServiceProvider : IUnknown
  4705. {
  4706.         // registers one service into it's internal table.. Object is refcounted.
  4707.         //   register a NULL value to remove the service
  4708.         HRESULT RegisterService([in] REFGUID guidService, [in] IUnknown *pUnkObject);
  4709. };
  4710.  
  4711.  
  4712. cpp_quote("#define AM_GETDECODERCAP_QUERY_VMR_SUPPORT   0x00000001")
  4713. cpp_quote("#define      VMR_NOTSUPPORTED                0x00000000")
  4714. cpp_quote("#define      VMR_SUPPORTED                   0x00000001")
  4715.  
  4716. cpp_quote("#define AM_QUERY_DECODER_VMR_SUPPORT         0x00000001")
  4717. cpp_quote("#define AM_QUERY_DECODER_DXVA_1_SUPPORT      0x00000002")
  4718.  
  4719. cpp_quote("#define AM_QUERY_DECODER_DVD_SUPPORT         0x00000003")
  4720. cpp_quote("#define AM_QUERY_DECODER_ATSC_SD_SUPPORT     0x00000004")
  4721. cpp_quote("#define AM_QUERY_DECODER_ATSC_HD_SUPPORT     0x00000005")
  4722.  
  4723. cpp_quote("#define      DECODER_CAP_NOTSUPPORTED        0x00000000")
  4724. cpp_quote("#define      DECODER_CAP_SUPPORTED           0x00000001")
  4725.  
  4726.  
  4727. [
  4728.         object,
  4729.         local,
  4730.         uuid(c0dff467-d499-4986-972b-e1d9090fa941),
  4731.         pointer_default(unique)
  4732. ]
  4733. interface IAMDecoderCaps : IUnknown
  4734. {
  4735.         HRESULT GetDecoderCaps([in] DWORD dwCapIndex, [out] DWORD* lpdwCap);
  4736. };
  4737.  
  4738.  
  4739.  
  4740. //---------------------------------------------------------------------
  4741. //
  4742. // IAMClockSlave interface
  4743. //
  4744. // When the audio renderer is slaving to a separate graph clock this 
  4745. // interface provides a way for an app to specify how closely in sync 
  4746. // the slaving renderer should try to stay to the graph clock. Note that 
  4747. // using a larger tolerance for a video & audio playback graph will likely 
  4748. // result in looser a/v sync, so it recommended not to change this setting 
  4749. // except under special circumstances. 
  4750. //
  4751. //---------------------------------------------------------------------
  4752.  
  4753. //
  4754. // Used to set/get the error tolerance used by a slaving audio renderer
  4755. //
  4756. [
  4757. object,
  4758.     uuid(9FD52741-176D-4b36-8F51-CA8F933223BE),
  4759.     pointer_default(unique)
  4760. ]
  4761. interface IAMClockSlave : IUnknown
  4762. {
  4763.     // set millisecond value to use for slaving tolerance
  4764.     // the allowed range is 1 to 1000ms
  4765.     HRESULT SetErrorTolerance (
  4766.         [in]  DWORD dwTolerance
  4767.     );
  4768.     
  4769.     // get millisecond value currently being used for slaving tolerance
  4770.     HRESULT GetErrorTolerance (
  4771.         [out]  DWORD *pdwTolerance
  4772.     );
  4773. };
  4774.  
  4775.  
  4776. /////////////////////////////////////////////////////////////////////////////
  4777. //
  4778. //  Windows XP vs. DirectX 8.0 header merge
  4779. //
  4780. //  The following is the original contents of this header from
  4781. //  the DirectX 8.0 SDK.
  4782. //
  4783. /////////////////////////////////////////////////////////////////////////////
  4784.  
  4785. #else     // DirectX 8.0 content
  4786.  
  4787.  
  4788.     // forward declarations - these are the interfaces declared in this file
  4789.  
  4790.     interface IEnumRegFilters;
  4791.     interface IFileSourceFilter;
  4792.     interface IFileSinkFilter;
  4793.     interface IFileSinkFilter2;
  4794.     interface IGraphBuilder;
  4795.     interface ICaptureGraphBuilder;
  4796.     interface ICaptureGraphBuilder2;
  4797.     interface IAMCopyCaptureFileProgress;
  4798.     interface IFilterMapper;
  4799.     interface IFilterMapper2;
  4800.     interface IMediaEventSink;
  4801.     interface IOverlay;
  4802.     interface IOverlayNotify;
  4803.     interface IOverlayNotify2;
  4804.     interface IQualityControl;
  4805.     interface ISeekingPassThru;
  4806.     interface IAMStreamConfig;
  4807.     interface IAMDevMemoryAllocator;
  4808.     interface IAMDevMemoryControl;
  4809.     interface IConfigInterleaving;
  4810.     interface IConfigAviMux;
  4811.     interface IAMVideoCompression;
  4812.     interface IAMVfwCaptureDialogs;
  4813.     interface IAMVfwCompressDialogs;
  4814.     interface IAMDroppedFrames;
  4815.     interface IAMAudioInputMixer;
  4816.     interface IAMBufferNegotiation;
  4817.     interface IAMAnalogVideoDecoder;
  4818.     interface IAMVideoProcAmp;
  4819.     interface IAMAnalogVideoEncoder;
  4820.     interface IAMCameraControl;
  4821.     interface IAMCrossbar;
  4822.     interface IAMTVTuner;
  4823.     interface IKsPropertySet;
  4824.     interface IAMPhysicalPinInfo;
  4825.     interface IAMExtDevice;
  4826.     interface IAMExtTransport;
  4827.     interface IAMTimecodeReader;
  4828.     interface IAMTimecodeGenerator;
  4829.     interface IAMTimecodeDisplay;
  4830.     interface IDrawVideoImage;
  4831.     interface IDecimateVideoImage;
  4832.     interface IAMVideoDecimationProperties;
  4833.     interface IAMPushSource;
  4834.     interface IAMAudioRendererStats;
  4835.     interface IAMLatency;
  4836.     interface IAMGraphStreams;
  4837.     interface IAMOverlayFX;
  4838.     interface IAMOpenProgress;
  4839.     interface IMpeg2Demultiplexer ;
  4840.     interface IMPEG2StreamIdMap ;
  4841.     interface IEnumStreamIdMap ;
  4842.  
  4843.     //==========================================================================
  4844.     //==========================================================================
  4845.     // IEnumRegFilters interface -- enumerates registered filters.
  4846.     // enumerator interface returned from IFilterMapper::EnumMatchingFilters().
  4847.     // based on IEnum pseudo-template
  4848.     //==========================================================================
  4849.     //==========================================================================
  4850.  
  4851.     typedef struct {
  4852.         CLSID Clsid;             // class id of the filter
  4853.         LPWSTR Name;             // name of filter
  4854.     } REGFILTER;
  4855.  
  4856.     [
  4857.     object,
  4858.     uuid(56a868a4-0ad4-11ce-b03a-0020af0ba770),
  4859.     pointer_default(unique)
  4860.     ]
  4861.  
  4862.     // The point of the mapper is to avoid loading filters.  By looking in the
  4863.     // registry we can reduce the number of filters which must be loaded and tried.
  4864.     // This enumerator returns descriptors of filters (including the GUIDs that
  4865.     // CoCreateInstance can instantiate).  The filters themselves are not loaded.
  4866.  
  4867.     interface IEnumRegFilters : IUnknown {
  4868.         import "unknwn.idl";
  4869.  
  4870.         // The caller must use CoTaskMemFree to free each REGFILTER* returned
  4871.         // in the array.
  4872.         HRESULT Next
  4873.             ( [in]  ULONG cFilters,           // place this many filters...
  4874.               [out] REGFILTER ** apRegFilter, // ...in this array of REGFILTER*
  4875.               [out] ULONG * pcFetched         // actual count passed returned here
  4876.             );
  4877.  
  4878.         // I can't think why anyone would want to skip, so it's not implemented.
  4879.         // (anyone who thinks they know what they would be skipping over is probably
  4880.         // missing some piece of the jigsaw). This ALWAYS returns E_NOTIMPL.
  4881.  
  4882.         HRESULT Skip(
  4883.             [in] ULONG cFilters
  4884.         );
  4885.  
  4886.         HRESULT Reset(void);
  4887.  
  4888.         // No cloning either - also ALWAYS returns E_NOTIMPL.
  4889.  
  4890.         HRESULT Clone(
  4891.             [out] IEnumRegFilters **ppEnum
  4892.         );
  4893.     }
  4894.  
  4895.  
  4896.     typedef IEnumRegFilters *PENUMREGFILTERS;
  4897.  
  4898.     //========================================================================
  4899.     //========================================================================
  4900.     // abstraction representing the registered information about filters.
  4901.     // This allows properties of filters to be looked up without loading them.
  4902.     //========================================================================
  4903.     //========================================================================
  4904.  
  4905.     [
  4906.     object,
  4907.     uuid(56a868a3-0ad4-11ce-b03a-0020af0ba770),
  4908.     pointer_default(unique)
  4909.     ]
  4910.     interface IFilterMapper : IUnknown {
  4911.         import "unknwn.idl";
  4912.  
  4913.         //==========================================================================
  4914.         // Registration functions.
  4915.         // A filter should be registered before any other use.
  4916.         // The registration can be NON_VOLATILE (i.e. permanent, do once ever)
  4917.         // or VOLATILE (once per boot of the system).
  4918.         // UnregisterFilter (obviously) removes the registration.
  4919.         // The action of any of the other calls on unregistered filters is undefined.
  4920.         // it will either work or you'll get an error, but I'm not saying which.
  4921.         //==========================================================================
  4922.  
  4923.         // Four predefined values controling the order in which filters are tried
  4924.         // for intelligent graph building.  Intermediate values are legal.
  4925.         // Any value <=MERIT_DO_NOT_USE will mean that the filter will never
  4926.         // be tried by the filtergrah to automatically complete a connection.
  4927.  
  4928.         enum { MERIT_PREFERRED     = 0x800000,
  4929.                MERIT_NORMAL        = 0x600000,
  4930.                MERIT_UNLIKELY      = 0x400000,
  4931.                MERIT_DO_NOT_USE    = 0x200000,
  4932.                MERIT_SW_COMPRESSOR = 0x100000,
  4933.                MERIT_HW_COMPRESSOR = 0x100050
  4934.              };
  4935.  
  4936.         // Register a filter
  4937.  
  4938.         HRESULT RegisterFilter
  4939.             ( [in] CLSID   clsid,    // GUID of the filter
  4940.               [in] LPCWSTR Name,     // Descriptive name for the filter
  4941.               [in] DWORD   dwMerit   // DO_NOT_USE, UNLIKELY, NORMAL or PREFERRED.
  4942.             );
  4943.  
  4944.  
  4945.         // Register an identifiable instance of a filter.  This deals with cases
  4946.         // such as two similar sound cards which are driven by the same driver,
  4947.         // but we want to choose which oif these cards the sound will come out of.
  4948.         // This is not needed if there is only one instance of the filter
  4949.         // (e.g. there is only one sound card in the machine) or if all instances
  4950.         // of the filter are equivalent.
  4951.  
  4952.         // The filter itself must have already been registered   // ??? Is that true?
  4953.         HRESULT RegisterFilterInstance
  4954.             ( [in]  CLSID  clsid,      // GUID of the filter
  4955.               [in]  LPCWSTR Name,      // Descriptive name of instance.
  4956.               [out] CLSID *MRId        // Returned Media Resource Id.  A
  4957.                                        // locally unique id for this instance
  4958.                                        // of this filter
  4959.             );
  4960.  
  4961.  
  4962.         HRESULT RegisterPin
  4963.             ( [in] CLSID   Filter,           // GUID of filter
  4964.               [in] LPCWSTR Name,             // Name of the pin
  4965.               [in] BOOL    bRendered,        // The filter renders this input
  4966.               [in] BOOL    bOutput,          // TRUE if this is an Output pin
  4967.               [in] BOOL    bZero,            // TRUE if OK for zero instances of pin
  4968.                                              // In this case you will have to Create
  4969.                                              // a pin to have even one instance
  4970.               [in] BOOL    bMany,            // TRUE if OK for many instances of pin
  4971.               [in] CLSID   ConnectsToFilter, // Filter it connects to if it has
  4972.                                              // subterranean connection, else NULL
  4973.               [in] LPCWSTR ConnectsToPin     // Name of pin it connects to
  4974.                                              // NULL for output pins
  4975.             );
  4976.  
  4977.         HRESULT RegisterPinType
  4978.             ( [in] CLSID   clsFilter,        // GUID of filter
  4979.               [in] LPCWSTR strName,          // Descriptive name of the pin
  4980.               [in] CLSID   clsMajorType,     // Major type of the data stream
  4981.               [in] CLSID   clsSubType        // Sub type of the data stream
  4982.             );
  4983.  
  4984.  
  4985.         HRESULT UnregisterFilter
  4986.             ( [in] CLSID  Filter             // GUID of filter
  4987.             );
  4988.  
  4989.  
  4990.         HRESULT UnregisterFilterInstance
  4991.             ( [in] CLSID  MRId               // Media Resource Id of this instance
  4992.             );
  4993.  
  4994.  
  4995.         HRESULT UnregisterPin
  4996.             ( [in] CLSID   Filter,           // GUID of filter
  4997.               [in] LPCWSTR Name              // Name of the pin
  4998.             );
  4999.  
  5000.  
  5001.         // Set *ppEnum to be an enumerator for filters matching the requirements.
  5002.  
  5003.         HRESULT EnumMatchingFilters
  5004.            ( [out] IEnumRegFilters **ppEnum  // enumerator returned
  5005.            , [in]  DWORD dwMerit             // at least this merit needed
  5006.            , [in]  BOOL  bInputNeeded        // need at least one input pin
  5007.            , [in]  CLSID clsInMaj            // input major type
  5008.            , [in]  CLSID clsInSub            // input sub type
  5009.            , [in]  BOOL  bRender             // must the input be rendered?
  5010.            , [in]  BOOL  bOututNeeded        // need at least one output pin
  5011.            , [in]  CLSID clsOutMaj           // output major type
  5012.            , [in]  CLSID clsOutSub           // output sub type
  5013.            );
  5014.  
  5015.     }
  5016.  
  5017.     // structure used to identify media types a pin handles. Used for
  5018.     // registration through IFilterMapper and IFilterMapper2
  5019.     //
  5020.     typedef struct
  5021.     {
  5022.         const CLSID * clsMajorType;
  5023.         const CLSID * clsMinorType;
  5024.     } REGPINTYPES;
  5025.  
  5026.     // describes pin for filter registration. Used for registration
  5027.     // through IFilterMapper and IFilterMapper2
  5028.     //
  5029.     typedef struct
  5030.     {
  5031.         LPWSTR           strName;
  5032.  
  5033.         // The filter renders this input
  5034.         BOOL             bRendered;
  5035.  
  5036.         // This is an Output pin
  5037.         BOOL             bOutput;
  5038.  
  5039.         // OK to have zero instances of pin In this case you will have to
  5040.         // Create a pin to have even one instance
  5041.         BOOL             bZero;
  5042.  
  5043.         // OK to create many instance of  pin
  5044.         BOOL             bMany;
  5045.  
  5046.         const CLSID *    clsConnectsToFilter;
  5047.         const WCHAR *    strConnectsToPin;
  5048.  
  5049.         UINT             nMediaTypes;
  5050.         const REGPINTYPES * lpMediaType;
  5051.     } REGFILTERPINS;
  5052.  
  5053.     // mediums (as defined in the Windows NT DDK) for registration with
  5054.     // IFilterMapper2
  5055.     //
  5056.     typedef struct
  5057.     {
  5058.         CLSID clsMedium;
  5059.         DWORD dw1;
  5060.         DWORD dw2;
  5061.     } REGPINMEDIUM;
  5062.  
  5063.     // flags for dwFlags in REFILTERPINS2
  5064.     enum
  5065.     {
  5066.         // OK to have zero instances of pin In this case you will have to
  5067.         // Create a pin to have even one instance
  5068.         REG_PINFLAG_B_ZERO = 0x1,
  5069.  
  5070.         // The filter renders this input
  5071.         REG_PINFLAG_B_RENDERER = 0x2,
  5072.  
  5073.         // OK to create many instance of  pin
  5074.         REG_PINFLAG_B_MANY = 0x4,
  5075.  
  5076.         // This is an Output pin
  5077.         REG_PINFLAG_B_OUTPUT = 0x8
  5078.     };
  5079.  
  5080.  
  5081.     // describes pin for filter registration through IFilterMapper2
  5082.     typedef struct
  5083.     {
  5084.         // combination of REG_PINFLAG flags
  5085.         DWORD dwFlags;
  5086.  
  5087.         // number of instances of the pin if known
  5088.         UINT             cInstances;
  5089.  
  5090.         UINT             nMediaTypes;
  5091.         [size_is(nMediaTypes)] const REGPINTYPES * lpMediaType;
  5092.  
  5093.         UINT             nMediums;
  5094.         [size_is(nMediums)] const REGPINMEDIUM *lpMedium;
  5095.  
  5096.         // pin category (for Kernel Streaming pins) as defined in the
  5097.         // Windows NT DDK
  5098.         const CLSID      *clsPinCategory;
  5099.  
  5100.     } REGFILTERPINS2;
  5101.  
  5102.     // describes filter for registration through IFilterMapper2
  5103.     typedef struct
  5104.     {
  5105.         DWORD dwVersion;            // 1 or 2
  5106.         DWORD dwMerit;
  5107.  
  5108.         /* unnamed union */
  5109.         [switch_is(dwVersion)] [switch_type(DWORD)] union
  5110.         {
  5111.             [case(1)]
  5112.  
  5113.                 struct
  5114.                 {
  5115.                     ULONG cPins;
  5116.                     [size_is(cPins)] const REGFILTERPINS *rgPins;
  5117.                 };
  5118.  
  5119.             [case(2)]
  5120.  
  5121.                 struct
  5122.                 {
  5123.                     ULONG cPins2;
  5124.                     [size_is(cPins2)] const REGFILTERPINS2 *rgPins2;
  5125.                 };
  5126.  
  5127.             [default]
  5128.                 ;
  5129.         } ;
  5130.  
  5131.     } REGFILTER2;
  5132.  
  5133.  
  5134.  
  5135.     [
  5136.     object,
  5137.     uuid(b79bb0b0-33c1-11d1-abe1-00a0c905f375),
  5138.     pointer_default(unique)
  5139.     ]
  5140.     interface IFilterMapper2 : IUnknown {
  5141.         import "unknwn.idl";
  5142.  
  5143.         // create or rename ActiveMovie category
  5144.         HRESULT CreateCategory
  5145.             ( [in] REFCLSID clsidCategory,
  5146.               [in] DWORD dwCategoryMerit,
  5147.               [in] LPCWSTR Description
  5148.               );
  5149.  
  5150.         HRESULT UnregisterFilter
  5151.             ( [in] const CLSID *pclsidCategory,
  5152.               [in] const OLECHAR *szInstance,
  5153.               [in] REFCLSID Filter // GUID of filter
  5154.             );
  5155.  
  5156.         // Register a filter, pins, and media types under a category.
  5157.         HRESULT RegisterFilter
  5158.             ( [in] REFCLSID clsidFilter,     // GUID of the filter
  5159.               [in] LPCWSTR Name,             // Descriptive name for the filter
  5160.  
  5161.               // ppMoniker can be null. or *ppMoniker can contain the
  5162.               // moniker where this filter data will be written;
  5163.               // *ppMoniker will be set to null on return. or *ppMoniker
  5164.               // can be null in which case the moniker will be returned
  5165.               // with refcount.
  5166.               [in, out] IMoniker **ppMoniker,
  5167.  
  5168.               // can be null
  5169.               [in] const CLSID *pclsidCategory,
  5170.  
  5171.               // cannot be null
  5172.               [in] const OLECHAR *szInstance,
  5173.  
  5174.               // rest of filter and pin registration
  5175.               [in] const REGFILTER2 *prf2
  5176.             );
  5177.  
  5178.         // Set *ppEnum to be an enumerator for filters matching the
  5179.         // requirements.
  5180.         HRESULT EnumMatchingFilters
  5181.            ( [out] IEnumMoniker **ppEnum           // enumerator returned
  5182.            , [in]  DWORD dwFlags                   // 0
  5183.            , [in]  BOOL bExactMatch                // don't match wildcards
  5184.            , [in]  DWORD dwMerit                   // at least this merit needed
  5185.            , [in]  BOOL  bInputNeeded              // need at least one input pin
  5186.            , [in]  DWORD cInputTypes               // Number of input types to match
  5187.                                                    // Any match is OK
  5188.            , [size_is(cInputTypes*2)]  const GUID *pInputTypes // input major+subtype pair array
  5189.            , [in]  const REGPINMEDIUM *pMedIn      // input medium
  5190.            , [in]  const CLSID *pPinCategoryIn     // input pin category
  5191.            , [in]  BOOL  bRender                   // must the input be rendered?
  5192.            , [in]  BOOL  bOutputNeeded             // need at least one output pin
  5193.            , [in]  DWORD cOutputTypes              // Number of output types to match
  5194.                                                    // Any match is OK
  5195.            , [size_is(cOutputTypes*2)]  const GUID *pOutputTypes // output major+subtype pair array
  5196.            , [in]  const REGPINMEDIUM *pMedOut     // output medium
  5197.            , [in]  const CLSID *pPinCategoryOut    // output pin category
  5198.            );
  5199.     }
  5200.  
  5201.     [
  5202.     object,
  5203.     uuid(b79bb0b1-33c1-11d1-abe1-00a0c905f375),
  5204.     pointer_default(unique)
  5205.     ]
  5206.     interface IFilterMapper3 : IFilterMapper2 {
  5207.         // new interface to allow creating filters using the mapper's devenum instance
  5208.         // primarily needed for out-of-proc access to a graph
  5209.         HRESULT GetICreateDevEnum( [out] ICreateDevEnum **ppEnum );
  5210.     }
  5211.  
  5212.     //========================================================================
  5213.     //========================================================================
  5214.     // Defines IQualityControl interface
  5215.     //
  5216.     // Defines quality messages and allows a quality manager to install itself
  5217.     // as the sink for quality messages.
  5218.     //========================================================================
  5219.     //========================================================================
  5220.  
  5221.     typedef enum tagQualityMessageType {
  5222.         Famine,
  5223.         Flood
  5224.     } QualityMessageType;
  5225.  
  5226.     typedef struct tagQuality {
  5227.         QualityMessageType Type;
  5228.         long                Proportion;   // milli-units.  1000 = no change
  5229.                                 // for Flood:
  5230.                                 // What proportion of the media samples currently
  5231.                                 // coming through are required in the future.
  5232.                                 // 800 means please drop another 20%
  5233.                                 // For Famine:
  5234.                                 // How much to "keep in" e.g. 800 means send me
  5235.                                 // 20% less e.g. by dropping 20% of the samples.
  5236.                                 // 1100 would mean "I'm coping, send me more".
  5237.         REFERENCE_TIME       Late;
  5238.                                 // How much you need to catch up by
  5239.         REFERENCE_TIME       TimeStamp;
  5240.                                 // The stream time when this was generated (probably
  5241.                                 // corresponds to the start time on some sample).
  5242.     } Quality;
  5243.  
  5244.     typedef IQualityControl *PQUALITYCONTROL;
  5245.  
  5246.  
  5247.     [
  5248.     object,
  5249.     uuid(56a868a5-0ad4-11ce-b03a-0020af0ba770),
  5250.     pointer_default(unique)
  5251.     ]
  5252.     interface IQualityControl : IUnknown {
  5253.  
  5254.         // Notify the recipient that a quality change is requested.
  5255.         // pSelf is the IBaseFilter* of the sender.
  5256.         // this is sent from a filter
  5257.         // to (the quality manager or) an upstream peer.
  5258.         HRESULT Notify
  5259.             ( [in] IBaseFilter * pSelf,
  5260.               [in] Quality q
  5261.             );
  5262.  
  5263.         // Notify the recipient that future quality messages are to be sent
  5264.         // to iqc.  If piqc is NULL then quality messages are to default back to
  5265.         // the upstream peer.
  5266.         // This is sent from the quality manager to a filter.
  5267.         // The recipient should hold piqc as a WEAK reference,
  5268.         // i.e. do not AddRef it, do not Release it.
  5269.         HRESULT SetSink
  5270.             ( [in] IQualityControl * piqc
  5271.             );
  5272.     }
  5273.  
  5274.     //=====================================================================
  5275.     //=====================================================================
  5276.     // Definitions required for overlay transport
  5277.     //=====================================================================
  5278.     //=====================================================================
  5279.  
  5280.  
  5281.     // Used to communicate the colour that the IOverlay client wants the window
  5282.     // painted in so that it can draw directly to the correct clipping region
  5283.     // A colour key can be described in two alternate ways, the first is by a
  5284.     // range of one or more (system) palette indices. The second is by defining
  5285.     // a colour cube with two RGB values, any of which would be acceptable.
  5286.     //
  5287.     // The CK values are consistent with GDI PALETTEINDEX and PALETTERGB macros
  5288.  
  5289.  
  5290.     enum { CK_NOCOLORKEY = 0x0,     // No color key is required
  5291.            CK_INDEX       = 0x1,    // Index into the current system palette
  5292.            CK_RGB         = 0x2 };  // Color key is an RGB value (or range)
  5293.  
  5294.     typedef struct tagCOLORKEY {
  5295.  
  5296.         DWORD    KeyType;           // Explains meaning of the structure
  5297.         DWORD    PaletteIndex;      // Palette index if available
  5298.         COLORREF LowColorValue;     // Low colour space RGB value
  5299.         COLORREF HighColorValue;    // Defines the high RGB value
  5300.  
  5301.     } COLORKEY;
  5302.  
  5303.     // When a filter sets up an advise link it can ask that only certain types
  5304.     // of notifications be sent, for example just palette changes. While this
  5305.     // doesn't mean that the other notification call backs won't ever be called
  5306.     // the IOverlay implementation may use this as an efficiency optimisation
  5307.  
  5308.     enum { ADVISE_NONE = 0x0,               // No notifications required
  5309.            ADVISE_CLIPPING = 0x1,           // Synchronous clip information
  5310.            ADVISE_PALETTE = 0x2,            // Palette change notifications
  5311.            ADVISE_COLORKEY = 0x4,           // Called when colour key changes
  5312.            ADVISE_POSITION = 0x8,           // Likewise when window moves etc
  5313.            ADVISE_DISPLAY_CHANGE = 0x10     // Called on WM_DISPLAYCHANGE
  5314.          };
  5315.  
  5316.     const DWORD ADVISE_ALL = ADVISE_CLIPPING |
  5317.                              ADVISE_PALETTE |
  5318.                              ADVISE_COLORKEY |
  5319.                              ADVISE_POSITION;
  5320.  
  5321.     const DWORD ADVISE_ALL2 = ADVISE_ALL |
  5322.                               ADVISE_DISPLAY_CHANGE;
  5323.  
  5324.     // This isn't defined when you run IDL
  5325.  
  5326.     cpp_quote("#ifndef _WINGDI_")
  5327.  
  5328.     typedef struct _RGNDATAHEADER {
  5329.         DWORD dwSize;
  5330.         DWORD iType;
  5331.         DWORD nCount;
  5332.         DWORD nRgnSize;
  5333.         RECT  rcBound;
  5334.     } RGNDATAHEADER;
  5335.  
  5336.     typedef struct _RGNDATA {
  5337.         RGNDATAHEADER rdh;
  5338.         char Buffer[1];
  5339.     } RGNDATA;
  5340.  
  5341.     cpp_quote("#endif")
  5342.  
  5343.  
  5344.     //=====================================================================
  5345.     //=====================================================================
  5346.     // Defines IOverlayNotify interface
  5347.     //
  5348.     // This interface gives asynchronous notifications of changes to the
  5349.     // rendering window - such as changes to the exposed window area
  5350.     //=====================================================================
  5351.     //=====================================================================
  5352.  
  5353.     [
  5354.     object,
  5355.     local,
  5356.     uuid(56a868a0-0ad4-11ce-b03a-0020af0ba770),
  5357.     pointer_default(unique)
  5358.     ]
  5359.     interface IOverlayNotify : IUnknown {
  5360.  
  5361.         // IOverlayNotify methods
  5362.  
  5363.         // This notifies the filter of palette changes, the filter should copy
  5364.         // the array of RGBQUADs if it needs to use them after returning. This
  5365.         // is not called when the palette is actually changed in the display
  5366.         // but at a short time after (in sync with WM_PALETTECHANGED messages)
  5367.  
  5368.         HRESULT OnPaletteChange(
  5369.             [in] DWORD dwColors,                // Number of colours present
  5370.             [in] const PALETTEENTRY *pPalette); // Array of palette colours
  5371.  
  5372.         // This provides synchronous clip changes so that the client is called
  5373.         // before the window is moved to freeze the video, and then when the
  5374.         // window has stabilised it is called again to start playback again.
  5375.         // If the window rect is all zero then the window is invisible, the
  5376.         // filter must take a copy of the information if it wants to keep it
  5377.  
  5378.         HRESULT OnClipChange(
  5379.             [in] const RECT *pSourceRect,       // Region of video to use
  5380.             [in] const RECT *pDestinationRect,  // Where video goes
  5381.             [in] const RGNDATA *pRgnData);      // Defines clipping information
  5382.  
  5383.         HRESULT OnColorKeyChange([in] const COLORKEY *pColorKey);
  5384.  
  5385.         // The calls to OnClipChange happen in sync with the window. So it is
  5386.         // called with an empty clip list before the window moves to freeze
  5387.         // the video, and then when the window has stabilised it is called
  5388.         // again with the new clip list. The OnPositionChange callback is for
  5389.         // overlay cards that don't want the expense of synchronous clipping
  5390.         // updates and just want to know when the source or destination video
  5391.         // positions change. They will NOT be called in sync with the window
  5392.         // but at some point after the window has changed (basicly in time
  5393.         // with WM_SIZE etc messages received). This is therefore suitable
  5394.         // for overlay cards that don't inlay their data to the frame buffer
  5395.         // NOTE the destination is NOT clipped to the visible display area
  5396.  
  5397.         HRESULT OnPositionChange([in] const RECT *pSourceRect,
  5398.                                  [in] const RECT *pDestinationRect);
  5399.     }
  5400.  
  5401.     typedef IOverlayNotify *POVERLAYNOTIFY;
  5402.  
  5403.  
  5404.     //=====================================================================
  5405.     //=====================================================================
  5406.     // Defines IOverlayNotify2 interface
  5407.     //
  5408.     // This interface gives asynchronous notifications of changes to the
  5409.     // rendering window - such as changes to the exposed window area
  5410.     // This is optionally supported by the advise sink for the purposes
  5411.     // of accepting OnDisplayChange notification.
  5412.     //=====================================================================
  5413.     //=====================================================================
  5414.  
  5415.     cpp_quote("#if !defined(HMONITOR_DECLARED) && !defined(HMONITOR) && (WINVER < 0x0500)")
  5416.     cpp_quote("#define HMONITOR_DECLARED")
  5417.     cpp_quote("#if 0")
  5418.     typedef HANDLE HMONITOR;
  5419.     cpp_quote("#endif")
  5420.     cpp_quote("DECLARE_HANDLE(HMONITOR);")
  5421.     cpp_quote("#endif")
  5422.  
  5423.     [
  5424.     object,
  5425.     local,
  5426.     uuid(680EFA10-D535-11D1-87C8-00A0C9223196),
  5427.     pointer_default(unique)
  5428.     ]
  5429.     interface IOverlayNotify2 : IOverlayNotify {
  5430.  
  5431.         // IOverlayNotify2 methods
  5432.  
  5433.         HRESULT OnDisplayChange(    // ADVISE_DISPLAY_CHANGE
  5434.             HMONITOR hMonitor);
  5435.     }
  5436.  
  5437.     typedef IOverlayNotify2 *POVERLAYNOTIFY2;
  5438.  
  5439.  
  5440.     //=====================================================================
  5441.     //=====================================================================
  5442.     // Defines IOverlay interface
  5443.     //
  5444.     // This interface provides information so that a filter can write direct to
  5445.     // the frame buffer while placing the video in the correct window position
  5446.     //=====================================================================
  5447.     //=====================================================================
  5448.  
  5449.     [
  5450.     object,
  5451.     local,
  5452.     uuid(56a868a1-0ad4-11ce-b03a-0020af0ba770),
  5453.     pointer_default(unique)
  5454.     ]
  5455.     interface IOverlay : IUnknown {
  5456.  
  5457.         // IOverlay methods
  5458.  
  5459.         HRESULT GetPalette(
  5460.             [out] DWORD *pdwColors,              // Number of colours present
  5461.             [out] PALETTEENTRY **ppPalette);     // Where to put palette data
  5462.  
  5463.         HRESULT SetPalette(
  5464.             [in] DWORD dwColors,                 // Number of colours present
  5465.             [in] PALETTEENTRY *pPalette);        // Colours to use for palette
  5466.  
  5467.         // If you change the colour key through SetColorKey then all the advise
  5468.         // links will receive an OnColorKeyChange callback with the new colour
  5469.  
  5470.         HRESULT GetDefaultColorKey([out] COLORKEY *pColorKey);
  5471.         HRESULT GetColorKey([out] COLORKEY *pColorKey);
  5472.         HRESULT SetColorKey([in,out] COLORKEY *pColorKey);
  5473.         HRESULT GetWindowHandle([out] HWND *pHwnd);
  5474.  
  5475.         // The IOverlay implementation allocates the memory for the clipping
  5476.         // rectangles as it can be variable in length. The filter calling
  5477.         // this method should free the memory when it is finished with it
  5478.  
  5479.         HRESULT GetClipList([out] RECT *pSourceRect,
  5480.                             [out] RECT *pDestinationRect,
  5481.                             [out] RGNDATA **ppRgnData);
  5482.  
  5483.         // Returns the current video source and destination
  5484.  
  5485.         HRESULT GetVideoPosition([out] RECT *pSourceRect,
  5486.                                  [out] RECT *pDestinationRect);
  5487.  
  5488.         HRESULT Advise(
  5489.             [in] IOverlayNotify *pOverlayNotify, // Notification interface
  5490.             [in] DWORD dwInterests);             // Callbacks interested in
  5491.  
  5492.         HRESULT Unadvise();                      // Stop the callbacks now
  5493.     }
  5494.  
  5495.     typedef IOverlay *POVERLAY;
  5496.  
  5497.  
  5498.     //=====================================================================
  5499.     //=====================================================================
  5500.     // control related interfaces (others are defined in control.odl)
  5501.     //=====================================================================
  5502.     //=====================================================================
  5503.  
  5504.  
  5505.     //=====================================================================
  5506.     //=====================================================================
  5507.     // Defines IMediaEventSink interface
  5508.     //
  5509.     // Exposed by filtergraph. Called by filters to notify events. Will be
  5510.     // passed on to application by the IMediaControl event methods.
  5511.     //=====================================================================
  5512.     //=====================================================================
  5513.  
  5514.     [
  5515.             object,
  5516.             uuid(56a868a2-0ad4-11ce-b03a-0020af0ba770),
  5517.             pointer_default(unique)
  5518.     ]
  5519.     interface IMediaEventSink : IUnknown {
  5520.  
  5521.         // notify an event. will be queued, but not delivered to
  5522.         // the application on this thread.
  5523.         HRESULT Notify(
  5524.             [in] long EventCode,
  5525.             [in] LONG_PTR EventParam1,
  5526.             [in] LONG_PTR EventParam2
  5527.         );
  5528.     }
  5529.  
  5530.     typedef IMediaEventSink *PMEDIAEVENTSINK;
  5531.  
  5532.     //=====================================================================
  5533.     //=====================================================================
  5534.     // Defines IFileSourceFilter interface
  5535.     //
  5536.     // Exposed by source filters to set the file name and media type.
  5537.     //=====================================================================
  5538.     //=====================================================================
  5539.  
  5540.     [
  5541.             object,
  5542.             uuid(56a868a6-0ad4-11ce-b03a-0020af0ba770),
  5543.             pointer_default(unique)
  5544.     ]
  5545.     interface IFileSourceFilter : IUnknown {
  5546.  
  5547.         // Load a file and assign it the given media type
  5548.         HRESULT Load(
  5549.             [in] LPCOLESTR pszFileName,     // Pointer to absolute path of file to open
  5550.             [in, unique] const AM_MEDIA_TYPE *pmt   // Media type of file - can be NULL
  5551.         );
  5552.         // Get the currently loaded file name
  5553.         HRESULT GetCurFile(
  5554.             [out] LPOLESTR *ppszFileName,   // Pointer to the path for the current file
  5555.             [out] AM_MEDIA_TYPE *pmt        // Pointer to the media type
  5556.         );
  5557.     }
  5558.  
  5559.     typedef IFileSourceFilter *PFILTERFILESOURCE;
  5560.  
  5561.     //=====================================================================
  5562.     //=====================================================================
  5563.     // Defines IFileSinkFilter interface
  5564.     //
  5565.     // Exposed by renderers to set the output file name.
  5566.     //=====================================================================
  5567.     //=====================================================================
  5568.  
  5569.     [
  5570.             object,
  5571.             uuid(a2104830-7c70-11cf-8bce-00aa00a3f1a6),
  5572.             pointer_default(unique)
  5573.     ]
  5574.     interface IFileSinkFilter : IUnknown {
  5575.  
  5576.         // Output to this file. default is to open the existing file
  5577.         HRESULT SetFileName(
  5578.             [in] LPCOLESTR pszFileName,     // Pointer to absolute path of output file
  5579.             [in, unique] const AM_MEDIA_TYPE *pmt   // Media type of file - can be NULL
  5580.         );
  5581.         // Get the current file name
  5582.         HRESULT GetCurFile(
  5583.             [out] LPOLESTR *ppszFileName,   // Pointer to the path for the current file
  5584.             [out] AM_MEDIA_TYPE *pmt        // Pointer to the media type
  5585.         );
  5586.     }
  5587.  
  5588.     typedef IFileSinkFilter *PFILTERFILESINK;
  5589.  
  5590.     [
  5591.             object,
  5592.             uuid(00855B90-CE1B-11d0-BD4F-00A0C911CE86),
  5593.             pointer_default(unique)
  5594.     ]
  5595.     interface IFileSinkFilter2 : IFileSinkFilter {
  5596.  
  5597.         HRESULT SetMode(
  5598.             [in] DWORD dwFlags              // AM_FILESINK_FLAGS
  5599.         );
  5600.  
  5601.         HRESULT GetMode(
  5602.             [out] DWORD *pdwFlags           // AM_FILESINK_FLAGS
  5603.         );
  5604.     }
  5605.  
  5606.     typedef IFileSinkFilter2 *PFILESINKFILTER2;
  5607.  
  5608.     typedef enum {
  5609.  
  5610.         // create a new file
  5611.         AM_FILE_OVERWRITE = 0x00000001,
  5612.  
  5613.     } AM_FILESINK_FLAGS;
  5614.  
  5615.  
  5616.     //
  5617.     // Intelligent connectivity for filters - an interface supported by
  5618.     // filter graphs (since it is an extension to IFilterGraph) that supports
  5619.     // building of graphs by automatic selection and connection of appropriate
  5620.     // filters
  5621.  
  5622.     [
  5623.         object,
  5624.         uuid(56a868a9-0ad4-11ce-b03a-0020af0ba770),
  5625.         pointer_default(unique)
  5626.     ]
  5627.     interface IGraphBuilder : IFilterGraph {
  5628.         // Connect these two pins directly or indirectly, using transform filters
  5629.         // if necessary.
  5630.  
  5631.         HRESULT Connect
  5632.             ( [in] IPin * ppinOut,    // the output pin
  5633.               [in] IPin * ppinIn      // the input pin
  5634.             );
  5635.  
  5636.  
  5637.         // Connect this output pin directly or indirectly, using transform filters
  5638.         // if necessary to something that will render it.
  5639.  
  5640.         HRESULT Render
  5641.             ( [in] IPin * ppinOut     // the output pin
  5642.             );
  5643.  
  5644.  
  5645.         // Build a filter graph that will render this file using this play list.
  5646.         // If lpwstrPlayList is NULL then it will use the default play list
  5647.         // which will typically render the whole file.
  5648.  
  5649.         HRESULT RenderFile
  5650.             ( [in] LPCWSTR lpcwstrFile,
  5651.               [in, unique] LPCWSTR lpcwstrPlayList
  5652.             );
  5653.  
  5654.  
  5655.         // Add to the filter graph a source filter for this file.  This would
  5656.         // be the same source filter that would be added by calling Render.
  5657.         // This call gives you more control over building
  5658.         // the rest of the graph, e.g. AddFilter(<a renderer of your choice>)
  5659.         // and then Connect the two.
  5660.         // The IBaseFilter* interface exposed by the source filter is returned
  5661.         // in ppFilter, addrefed already for you
  5662.         // The filter will be known by the name lpcwstrFIlterName
  5663.         // nn this filter graph,
  5664.         HRESULT AddSourceFilter
  5665.             ( [in]      LPCWSTR lpcwstrFileName,
  5666.               [in, unique]      LPCWSTR lpcwstrFilterName,
  5667.               [out]     IBaseFilter* *ppFilter
  5668.             );
  5669.  
  5670.  
  5671.         // If this call is made then trace information will be written to the
  5672.         // file showing the actions taken in attempting to perform an operation.
  5673.         HRESULT SetLogFile
  5674.             ( [in]      DWORD_PTR hFile  // open file handle e.g. from CreateFile
  5675.             );
  5676.  
  5677.  
  5678.         // Request that the graph builder should return as soon as possible from
  5679.         // its current task.
  5680.         // Note that it is possible fot the following to occur in the following
  5681.         // sequence:
  5682.         //     Operation begins; Abort is requested; Operation completes normally.
  5683.         // This would be normal whenever the quickest way to finish an operation
  5684.         // was to simply continue to the end.
  5685.         HRESULT Abort();
  5686.  
  5687.         // Return S_OK if the curent operation is to continue,
  5688.         // return S_FALSE if the current operation is to be aborted.
  5689.         // This method can be called as a callback from a filter which is doing
  5690.         // some operation at the request of the graph.
  5691.         HRESULT ShouldOperationContinue();
  5692.  
  5693.     }
  5694.  
  5695.  
  5696.     //
  5697.     // New capture graph builder
  5698.  
  5699.     [
  5700.         object,
  5701.         uuid(bf87b6e0-8c27-11d0-b3f0-00aa003761c5),
  5702.         pointer_default(unique)
  5703.     ]
  5704.     interface ICaptureGraphBuilder : IUnknown {
  5705.  
  5706.         // Use this filtergraph
  5707.         HRESULT SetFiltergraph(
  5708.         [in] IGraphBuilder *pfg);
  5709.  
  5710.         // what filtergraph are you using?
  5711.         // *ppfg->Release() when you're done with it
  5712.         HRESULT GetFiltergraph(
  5713.         [out] IGraphBuilder **ppfg);
  5714.  
  5715.         // creates a rendering section in the filtergraph consisting of a MUX
  5716.         // of some filetype, and a file writer (and connects them together)
  5717.         // *ppf->Release() when you're done with it
  5718.         // *ppSink->Release() when you're done with it
  5719.         HRESULT SetOutputFileName(
  5720.         [in] const GUID *pType, // type of file to write, eg. MEDIASUBTYPE_Avi
  5721.         [in] LPCOLESTR lpstrFile,   // filename given to file writer
  5722.         [out] IBaseFilter **ppf,    // returns pointer to the MUX
  5723.             [out] IFileSinkFilter **ppSink);// queried from file writer
  5724.  
  5725.         // Looks for an interface on the filter and on the output pin of the given
  5726.         // category.  (Categories: CAPTURE/PREVIEW/VIDEOPORT/VBI etc. or
  5727.         // NULL for "don't care".
  5728.         // It will also look upstream and downstream of
  5729.         // the pin for the interface, to find interfaces on renderers, MUXES, TV
  5730.         // Tuners, etc.
  5731.         // Call *ppint->Release() when you're done with it
  5732.         [local] HRESULT FindInterface(
  5733.         [in, unique] const GUID *pCategory, // can be NULL for all pins
  5734.         [in] IBaseFilter *pf,
  5735.         [in] REFIID riid,
  5736.         [out] void **ppint);
  5737.         [call_as(FindInterface)] HRESULT RemoteFindInterface(
  5738.         [in, unique] const GUID *pCategory, // can be NULL for all pins
  5739.         [in] IBaseFilter *pf,
  5740.         [in] REFIID riid,
  5741.         [out] IUnknown **ppint);
  5742.  
  5743.         // Connects the pin of the given category of the source filter to the
  5744.         // rendering filter, optionally through another filter (compressor?)
  5745.         // For a non-NULL category, it will instantiate and connect additional
  5746.         // required filters upstream too, like TV Tuners and Crossbars.
  5747.         // If there is only one output pin on the source, use a NULL
  5748.         // category.  You can also have pSource be a pin
  5749.         HRESULT RenderStream(
  5750.         [in] const GUID *pCategory, // can be NULL if only one output pin
  5751.         [in] IUnknown *pSource,     // filter or pin
  5752.         [in] IBaseFilter *pfCompressor,
  5753.         [in] IBaseFilter *pfRenderer);  // can be NULL
  5754.  
  5755.         // Sends IAMStreamControl messages to the pin of the desired category, eg.
  5756.         // "capture" or "preview"
  5757.         // REFERENCE_TIME=NULL means NOW
  5758.         // REFERENCE_TIME=MAX_TIME means never, or cancel previous request
  5759.         // NULL controls all capture filters in the graph - you will get one
  5760.         //     notification for each filter with a pin of that category found
  5761.         // returns S_FALSE if stop will be signalled before last sample is
  5762.         //     rendered.
  5763.         // return a FAILURE code if the filter does not support IAMStreamControl
  5764.         HRESULT ControlStream(
  5765.         [in] const GUID *pCategory,
  5766.         [in] IBaseFilter *pFilter,
  5767.         [in] REFERENCE_TIME *pstart,
  5768.         [in] REFERENCE_TIME *pstop,
  5769.         [in] WORD wStartCookie,     // high word reserved
  5770.         [in] WORD wStopCookie);     // high word reserved
  5771.  
  5772.         // creates a pre-allocated file of a given size in bytes
  5773.         HRESULT AllocCapFile(
  5774.         [in] LPCOLESTR lpstr,
  5775.         [in] DWORDLONG dwlSize);
  5776.  
  5777.         // Copies the valid file data out of the old, possibly huge old capture
  5778.         //   file into a shorter new file.
  5779.         // Return S_FALSE from your progress function to abort capture, S_OK to
  5780.         //   continue
  5781.         HRESULT CopyCaptureFile(
  5782.         [in] LPOLESTR lpwstrOld,
  5783.         [in] LPOLESTR lpwstrNew,
  5784.         [in] int fAllowEscAbort,    // pressing ESC will abort?
  5785.         [in] IAMCopyCaptureFileProgress *pCallback);    // implement this to
  5786.                                 // get progress
  5787.     }
  5788.  
  5789.  
  5790.     //
  5791.     // Capture graph builder "CopyCapturedFile" progress callback
  5792.  
  5793.     [
  5794.         object,
  5795.         uuid(670d1d20-a068-11d0-b3f0-00aa003761c5),
  5796.         pointer_default(unique)
  5797.     ]
  5798.     interface IAMCopyCaptureFileProgress : IUnknown {
  5799.  
  5800.         // If you support this interface somewhere, this function will be called
  5801.         // periodically while ICaptureGraphBuilder::CopyCaptureFile is executing
  5802.         // to let you know the progress
  5803.         //
  5804.         // Return S_OK from this function to continue.  Return S_FALSE to abort the
  5805.         // copy
  5806.         HRESULT Progress(
  5807.         [in] int iProgress);        // a number between 0 and 100 (%)
  5808.     }
  5809.  
  5810.  
  5811.     //
  5812.     // Capture graph builder that can deal with a single filter having more than
  5813.     // one pin of each category... some new devices can capture both audio and
  5814.     // video, for example
  5815.     //
  5816.  
  5817.     [
  5818.         object,
  5819.         uuid(93E5A4E0-2D50-11d2-ABFA-00A0C9C6E38D),
  5820.         pointer_default(unique)
  5821.     ]
  5822.     interface ICaptureGraphBuilder2 : IUnknown {
  5823.  
  5824.         // Use this filtergraph
  5825.         HRESULT SetFiltergraph(
  5826.         [in] IGraphBuilder *pfg);
  5827.  
  5828.         // what filtergraph are you using?
  5829.         // *ppfg->Release() when you're done with it
  5830.         HRESULT GetFiltergraph(
  5831.         [out] IGraphBuilder **ppfg);
  5832.  
  5833.         // creates a rendering section in the filtergraph consisting of a MUX
  5834.         // of some filetype, and a file writer (and connects them together)
  5835.         // *ppf->Release() when you're done with it
  5836.         // *ppSink->Release() when you're done with it
  5837.         HRESULT SetOutputFileName(
  5838.         [in] const GUID *pType,     // GUID of MUX filter to use
  5839.         [in] LPCOLESTR lpstrFile,   // filename given to file writer
  5840.         [out] IBaseFilter **ppf,    // returns pointer to the MUX
  5841.         [out] IFileSinkFilter **ppSink);// queried from file writer
  5842.  
  5843.         // Looks for an interface on the filter and on the output pin of the given
  5844.         // category and type.  (Categories: CAPTURE/PREVIEW/VIDEOPORT/VBI etc. or
  5845.         // NULL for "don't care".  Type:  MAJORTYPE_Video/Audio etc or NULL)
  5846.         // !!! Will some filters have >1 capture pin?  ie RGB and MPEG?
  5847.         // It will also look upstream and downstream of
  5848.         // the pin for the interface, to find interfaces on renderers, MUXES, TV
  5849.         // Tuners, etc.
  5850.         // Call *ppint->Release() when you're done with it
  5851.         [local] HRESULT FindInterface(
  5852.         [in] const GUID *pCategory, // can be NULL for all pins
  5853.         [in] const GUID *pType,     // Audio/Video/??? or NULL (don't care)
  5854.         [in] IBaseFilter *pf,
  5855.         [in] REFIID riid,
  5856.         [out] void **ppint);
  5857.         [call_as(FindInterface)] HRESULT RemoteFindInterface(
  5858.         [in] const GUID *pCategory, // can be NULL for all pins
  5859.         [in] const GUID *pType,     // Audio/Video/??? or NULL (don't care)
  5860.         [in] IBaseFilter *pf,
  5861.         [in] REFIID riid,
  5862.         [out] IUnknown **ppint);
  5863.  
  5864.         // Connects the pin of the given category and type of the source filter to
  5865.         // the rendering filter, optionally through another filter (compressor?)
  5866.         // (Type is a Majortype, like Video or Audio)
  5867.         // For a non-NULL category, it will instantiate and connect additional
  5868.         // required filters upstream too, like TV Tuners and Crossbars.
  5869.         // If there is only one output pin on the source, use a NULL category
  5870.         // and type.  You can also have pSource be a pin
  5871.         HRESULT RenderStream(
  5872.         [in] const GUID *pCategory, // can be NULL if only one output pin
  5873.         [in] const GUID *pType,     // Major type (Video/Audio/etc)
  5874.         [in] IUnknown *pSource,     // filter or pin
  5875.         [in] IBaseFilter *pfCompressor,
  5876.         [in] IBaseFilter *pfRenderer);  // can be NULL
  5877.  
  5878.         // Sends IAMStreamControl messages to the pin of the desired category,
  5879.         // (eg. "capture" or "preview") and of the desired type (eg. VIDEO or AUDIO)
  5880.         // A category MUST be given.  If a filter is given, a type must be too.
  5881.         // REFERENCE_TIME=NULL means NOW
  5882.         // REFERENCE_TIME=MAX_TIME means never, or cancel previous request
  5883.         // NULL controls all capture filters in the graph - you will get one
  5884.         //     notification for each filter with a pin of that category found
  5885.         // returns S_FALSE if stop will be signalled before last sample is
  5886.         //     rendered.
  5887.         // return a FAILURE code if the filter does not support IAMStreamControl
  5888.         HRESULT ControlStream(
  5889.         [in] const GUID *pCategory,
  5890.         [in] const GUID *pType,     // Major type (Video/Audio/etc)
  5891.         [in] IBaseFilter *pFilter,
  5892.         [in] REFERENCE_TIME *pstart,
  5893.         [in] REFERENCE_TIME *pstop,
  5894.         [in] WORD wStartCookie,     // high word reserved
  5895.         [in] WORD wStopCookie);     // high word reserved
  5896.  
  5897.         // creates a pre-allocated file of a given size in bytes
  5898.         HRESULT AllocCapFile(
  5899.         [in] LPCOLESTR lpstr,
  5900.         [in] DWORDLONG dwlSize);
  5901.  
  5902.         // Copies the valid file data out of the old, possibly huge old capture
  5903.         //   file into a shorter new file.
  5904.         // Return S_FALSE from your progress function to abort capture, S_OK to
  5905.         //   continue
  5906.         HRESULT CopyCaptureFile(
  5907.         [in] LPOLESTR lpwstrOld,
  5908.         [in] LPOLESTR lpwstrNew,
  5909.         [in] int fAllowEscAbort,    // pressing ESC will abort?
  5910.         [in] IAMCopyCaptureFileProgress *pCallback);    // implement this to
  5911.                                 // get progress
  5912.         // Helper fn to find a certain pin on a filter.
  5913.         HRESULT FindPin(
  5914.         [in] IUnknown *pSource,
  5915.         [in] PIN_DIRECTION pindir,  // input or output?
  5916.         [in] const GUID *pCategory, // what category? (or NULL)
  5917.         [in] const GUID *pType,     // what Major type (or NULL)
  5918.         [in] BOOL fUnconnected,     // must it be unconnected?
  5919.         [in] int num,           // which pin matching this? (0 based)
  5920.         [out] IPin **ppPin);
  5921.     }
  5922.  
  5923.     enum _AM_RENSDEREXFLAGS {
  5924.         AM_RENDEREX_RENDERTOEXISTINGRENDERERS = 0x01 // Dont add any renderers
  5925.     };
  5926.  
  5927.     //
  5928.     // IFilterGraph2
  5929.     //
  5930.     // New methods on for IFilterGraph and IGraphBuilder will have to go here.
  5931.     //
  5932.  
  5933.     [
  5934.         object,
  5935.         uuid(36b73882-c2c8-11cf-8b46-00805f6cef60),
  5936.         pointer_default(unique)
  5937.     ]
  5938.     interface IFilterGraph2: IGraphBuilder {
  5939.  
  5940.         // Add a Moniker source moniker
  5941.         HRESULT AddSourceFilterForMoniker(
  5942.               [in] IMoniker *pMoniker,
  5943.               [in] IBindCtx *pCtx,
  5944.               [in, unique] LPCWSTR lpcwstrFilterName,
  5945.               [out] IBaseFilter **ppFilter
  5946.         );
  5947.  
  5948.         // Specify the type for a reconnect
  5949.         // This is better than Reconnect as sometime the parties to a
  5950.         // reconnection can't remember what type they'd agreed (!)
  5951.         HRESULT ReconnectEx
  5952.             ( [in] IPin * ppin,             // the pin to disconnect and reconnect
  5953.               [in, unique] const AM_MEDIA_TYPE *pmt // the type to reconnect with - can be NULL
  5954.             );
  5955.  
  5956.         // Render a pin without adding any new renderers
  5957.         HRESULT RenderEx( [in] IPin *pPinOut,         // Pin to render
  5958.                           [in] DWORD dwFlags,         // flags
  5959.                           [in, out] DWORD *pvContext   // Unused - set to NULL
  5960.                         );
  5961.  
  5962.     #if 0
  5963.         // Method looks for a filter which supports the specified interface.  If such
  5964.         // a filter exists, an AddRef()'ed pointer to the requested interface is placed
  5965.         // in *ppInterface.
  5966.         //
  5967.         // *ppInterface will be NULL on return if such a filter could not be found, and
  5968.         // the method will return E_NOINTERFACE.
  5969.         //
  5970.         // pdwIndex is an internal index that is used for obtaining subsequent interfaces.
  5971.         // *pdwIndex should be initialized to zero.  It is set on return to a value that
  5972.         // allows the implementation of FindFilterInterface to search for further interfaces
  5973.         // if called again.  If no more such interfaces exist, the method will return E_NOINTERFACE.
  5974.         //
  5975.         // If pdwIndex is NULL, FindFilterInterface returns an interface only if there is just
  5976.         // a single filter in the graph that supports the interface.  Otherwise it returns
  5977.         // E_NOINTERFACE.
  5978.         //
  5979.         HRESULT FindFilterInterface( [in] REFIID iid, [out] void ** ppInterface, [in,out] LPDWORD pdwIndex );
  5980.  
  5981.         // Tries to obtain the interface from the filter graph itself.  If this fails,
  5982.         // it attempts to find the unique filter that supports the interface.
  5983.         // On failure the method will return E_NOINTERFACE.  On success, it returns
  5984.         // S_OK and an AddRef()'ed pointer to the requested interface in *ppInterface.
  5985.         //
  5986.         HRESULT FindInterface( [in] REFIID iid, [out] void ** ppInterface );
  5987.  
  5988.     #endif
  5989.     }
  5990.  
  5991.     //
  5992.     // StreamBuilder
  5993.     // aka Graph building with constraints
  5994.     // aka convergent graphs
  5995.     // aka Closed captioning
  5996.  
  5997.     [
  5998.         object,
  5999.         local,
  6000.         uuid(56a868bf-0ad4-11ce-b03a-0020af0ba770),
  6001.         pointer_default(unique)
  6002.     ]
  6003.     interface IStreamBuilder : IUnknown {
  6004.  
  6005.         // Connect this output pin directly or indirectly, using transform filters
  6006.         // if necessary to thing(s) that will render it, within this graph
  6007.         // Move from Initial state to Rendered state.
  6008.  
  6009.         HRESULT Render
  6010.             ( [in] IPin * ppinOut,         // the output pin
  6011.               [in] IGraphBuilder * pGraph  // the graph
  6012.             );
  6013.  
  6014.         // Undo what you did in Render.  Return to Initial state.
  6015.         HRESULT Backout
  6016.             ( [in] IPin * ppinOut,         // the output pin
  6017.               [in] IGraphBuilder * pGraph  // the graph
  6018.             );
  6019.     }
  6020.  
  6021.  
  6022.     // async reader interface - supported by file source filters. Allows
  6023.     // multiple overlapped reads from different positions
  6024.  
  6025.  
  6026.     [
  6027.             object,
  6028.             uuid(56a868aa-0ad4-11ce-b03a-0020af0ba770),
  6029.             pointer_default(unique)
  6030.     ]
  6031.     interface IAsyncReader : IUnknown
  6032.     {
  6033.         // pass in your preferred allocator and your preferred properties.
  6034.         // method returns the actual allocator to be used. Call GetProperties
  6035.         // on returned allocator to learn alignment and prefix etc chosen.
  6036.         // this allocator will be not be committed and decommitted by
  6037.         // the async reader, only by the consumer.
  6038.         // Must call this before calling Request.
  6039.         HRESULT RequestAllocator(
  6040.                     [in]  IMemAllocator* pPreferred,
  6041.                     [in]  ALLOCATOR_PROPERTIES* pProps,
  6042.                     [out] IMemAllocator ** ppActual);
  6043.  
  6044.         // queue a request for data.
  6045.         // media sample start and stop times contain the requested absolute
  6046.         // byte position (start inclusive, stop exclusive).
  6047.         // may fail if sample not obtained from agreed allocator.
  6048.         // may fail if start/stop position does not match agreed alignment.
  6049.         // samples allocated from source pin's allocator may fail
  6050.         // GetPointer until after returning from WaitForNext.
  6051.         // Stop position must be aligned - this means it may exceed duration.
  6052.         // on completion, stop position will be corrected to unaligned
  6053.         // actual data.
  6054.         HRESULT Request(
  6055.                     [in] IMediaSample* pSample,
  6056.                     [in] DWORD_PTR dwUser);         // user context
  6057.  
  6058.         // block until the next sample is completed or the timeout occurs.
  6059.         // timeout (millisecs) may be 0 or INFINITE. Samples may not
  6060.         // be delivered in order. If there is a read error of any sort, a
  6061.         // notification will already have been sent by the source filter,
  6062.         // and HRESULT will be an error.
  6063.         // If ppSample is not null, then a Request completed with the result
  6064.         // code returned.
  6065.         HRESULT WaitForNext(
  6066.                     [in]  DWORD dwTimeout,
  6067.                     [out] IMediaSample** ppSample,  // completed sample
  6068.                     [out] DWORD_PTR * pdwUser);     // user context
  6069.  
  6070.         // sync read of data. Sample passed in must have been acquired from
  6071.         // the agreed allocator. Start and stop position must be aligned.
  6072.         // equivalent to a Request/WaitForNext pair, but may avoid the
  6073.         // need for a thread on the source filter.
  6074.         HRESULT SyncReadAligned(
  6075.                     [in] IMediaSample* pSample);
  6076.  
  6077.  
  6078.         // sync read. works in stopped state as well as run state.
  6079.         // need not be aligned. Will fail if read is beyond actual total
  6080.         // length.
  6081.         HRESULT SyncRead(
  6082.                     [in]  LONGLONG llPosition,  // absolute file position
  6083.                     [in]  LONG lLength,     // nr bytes required
  6084.                     [out, size_is(lLength)]
  6085.                   BYTE* pBuffer);       // write data here
  6086.  
  6087.         // return total length of stream, and currently available length.
  6088.         // reads for beyond the available length but within the total length will
  6089.         // normally succeed but may block for a long period.
  6090.         HRESULT Length(
  6091.                     [out] LONGLONG* pTotal,
  6092.                     [out] LONGLONG* pAvailable);
  6093.  
  6094.         // cause all outstanding reads to return, possibly with a failure code
  6095.         //(VFW_E_TIMEOUT) indicating they were cancelled.
  6096.         // Between BeginFlush and EndFlush calls, Request calls will fail and
  6097.         // WaitForNext calls will always complete immediately.
  6098.         HRESULT BeginFlush(void);
  6099.         HRESULT EndFlush(void);
  6100.     }
  6101.  
  6102.  
  6103.     // interface provided by the filtergraph itself to let other objects
  6104.     // (especially plug-in distributors, but also apps like graphedt) know
  6105.     // when the graph has changed.
  6106.     [
  6107.         object,
  6108.         uuid(56a868ab-0ad4-11ce-b03a-0020af0ba770),
  6109.         pointer_default(unique)
  6110.     ]
  6111.     interface IGraphVersion : IUnknown
  6112.     {
  6113.         // returns the current graph version number
  6114.         // this is incremented every time there is a change in the
  6115.         // set of filters in the graph or in their connections
  6116.         //
  6117.         // if this is changed since your last enumeration, then re-enumerate
  6118.         // the graph
  6119.         HRESULT QueryVersion(LONG* pVersion);
  6120.     }
  6121.  
  6122.  
  6123.  
  6124.  
  6125.     //
  6126.     // interface describing an object that uses resources.
  6127.     //
  6128.     // implement if: you request resources using IResourceManager. You will
  6129.     // need to pass your implementation of this pointer as an in param.
  6130.     //
  6131.     // use if: you are a resource manager who implements IResourceManager
  6132.     [
  6133.         object,
  6134.         uuid(56a868ad-0ad4-11ce-b03a-0020af0ba770),
  6135.         pointer_default(unique)
  6136.     ]
  6137.     interface IResourceConsumer : IUnknown
  6138.     {
  6139.         // you may acquire the resource specified.
  6140.         // return values:
  6141.         //      S_OK    -- I have successfully acquired it
  6142.         //      S_FALSE -- I will acquire it and call NotifyAcquire afterwards
  6143.         //      VFW_S_NOT_NEEDED: I no longer need the resource
  6144.         //      FAILED(hr)-I tried to acquire it and failed.
  6145.  
  6146.         HRESULT
  6147.         AcquireResource(
  6148.             [in] LONG idResource);
  6149.  
  6150.  
  6151.  
  6152.         // Please release the resource.
  6153.         // return values:
  6154.         //      S_OK    -- I have released it (and want it again when available)
  6155.         //      S_FALSE -- I will call NotifyRelease when I have released it
  6156.         //      other   something went wrong.
  6157.         HRESULT
  6158.         ReleaseResource(
  6159.             [in] LONG idResource);
  6160.     }
  6161.  
  6162.  
  6163.  
  6164.     // interface describing a resource manager that will resolve contention for
  6165.     // named resources.
  6166.     //
  6167.     // implement if: you are a resource manager. The filtergraph will be a resource
  6168.     // manager, internally delegating to the system wide resource manager
  6169.     // (when there is one)
  6170.     //
  6171.     // use if: you need resources that are limited. Use the resource manager to
  6172.     // resolve contention by registering the resource with this interface,
  6173.     // and requesting it from this interface whenever needed.
  6174.     //
  6175.     // or use if: you detect focus changes which should affect resource usage.
  6176.     // Notifying change of focus to the resource manager will cause the resource
  6177.     // manager to switch contended resources to the objects that have the user's
  6178.     // focus
  6179.     [
  6180.         object,
  6181.         uuid(56a868ac-0ad4-11ce-b03a-0020af0ba770),
  6182.         pointer_default(unique)
  6183.     ]
  6184.     interface IResourceManager : IUnknown
  6185.     {
  6186.         // tell the manager how many there are of a resource.
  6187.         // ok if already registered. will take new count. if new count
  6188.         // is lower, will de-allocate resources to new count.
  6189.         //
  6190.         // You get back a token that will be used in further calls.
  6191.         //
  6192.         // Passing a count of 0 will eliminate this resource. There is currently
  6193.         // no defined way to find the id without knowing the count.
  6194.         //
  6195.         HRESULT
  6196.         Register(
  6197.             [in] LPCWSTR pName,         // this named resource
  6198.             [in] LONG   cResource,      // has this many instances
  6199.             [out] LONG* plToken         // token placed here on return
  6200.             );
  6201.  
  6202.         HRESULT
  6203.         RegisterGroup(
  6204.             [in] LPCWSTR pName,         // this named resource group
  6205.             [in] LONG cResource,        // has this many resources
  6206.             [in, size_is(cResource)]
  6207.                  LONG* palTokens,      // these are the contained resources
  6208.             [out] LONG* plToken        // group resource id put here on return
  6209.             );
  6210.  
  6211.         // request the use of a given, registered resource.
  6212.         // possible return values:
  6213.         //      S_OK == yes you can use it now
  6214.         //      S_FALSE == you will be called back when the resource is available
  6215.         //      other - there is an error.
  6216.         //
  6217.         // The priority of this request should be affected by the associated
  6218.         // focus object -- that is, when SetFocus is called for that focus
  6219.         // object (or a 'related' object) then my request should be put through.
  6220.         //
  6221.         // A filter should pass the filter's IUnknown here. The filtergraph
  6222.         // will match filters to the filtergraph, and will attempt to trace
  6223.         // filters to common source filters when checking focus objects.
  6224.         // The Focus object must be valid for the entire lifetime of the request
  6225.         // -- until you call CancelRequest or NotifyRelease(id, p, FALSE)
  6226.         HRESULT
  6227.         RequestResource(
  6228.             [in] LONG idResource,
  6229.             [in] IUnknown* pFocusObject,
  6230.             [in] IResourceConsumer* pConsumer
  6231.             );
  6232.  
  6233.  
  6234.         // notify the resource manager that an acquisition attempt completed.
  6235.         // Call this method after an AcquireResource method returned
  6236.         // S_FALSE to indicate asynchronous acquisition.
  6237.         // HR should be S_OK if the resource was successfully acquired, or a
  6238.         // failure code if the resource could not be acquired.
  6239.         HRESULT
  6240.         NotifyAcquire(
  6241.             [in] LONG idResource,
  6242.             [in] IResourceConsumer* pConsumer,
  6243.             [in] HRESULT hr);
  6244.  
  6245.         // Notify the resource manager that you have released a resource. Call
  6246.         // this in response to a ReleaseResource method, or when you have finished
  6247.         // with the resource. bStillWant should be TRUE if you still want the
  6248.         // resource when it is next available, or FALSE if you no longer want
  6249.         // the resource.
  6250.         HRESULT
  6251.         NotifyRelease(
  6252.             [in] LONG idResource,
  6253.             [in] IResourceConsumer* pConsumer,
  6254.             [in] BOOL bStillWant);
  6255.  
  6256.         // I don't currently have the resource, and I no longer need it.
  6257.         HRESULT
  6258.         CancelRequest(
  6259.             [in] LONG idResource,
  6260.             [in] IResourceConsumer* pConsumer);
  6261.  
  6262.         // Notify the resource manager that a given object has been given the
  6263.         // user's focus. In ActiveMovie, this will normally be a video renderer
  6264.         // whose window has received the focus. The filter graph will switch
  6265.         // contended resources to (in order):
  6266.         //      requests made with this same focus object
  6267.         //      requests whose focus object shares a common source with this
  6268.         //      requests whose focus object shares a common filter graph
  6269.         // After calling this, you *must* call ReleaseFocus before the IUnknown
  6270.         // becomes invalid, unless you can guarantee that another SetFocus
  6271.         // of a different object is done in the meantime. No addref is held.
  6272.         //
  6273.         // The resource manager will hold this pointer until replaced or cancelled,
  6274.         // and will use it to resolve resource contention. It will call
  6275.         // QueryInterface for IBaseFilter at least and if found will call methods on
  6276.         // that interface.
  6277.         HRESULT
  6278.         SetFocus(
  6279.             [in] IUnknown* pFocusObject);
  6280.  
  6281.         // Sets the focus to NULL if the current focus object is still
  6282.         // pFocusObject. Call this when
  6283.         // the focus object is about to be destroyed to ensure that no-one is
  6284.         // still referencing the object.
  6285.         HRESULT
  6286.         ReleaseFocus(
  6287.             [in] IUnknown* pFocusObject);
  6288.  
  6289.  
  6290.  
  6291.     // !!! still need
  6292.     //      -- app override (some form of SetPriority)
  6293.     //      -- enumeration and description of resources
  6294.  
  6295.     }
  6296.  
  6297.  
  6298.     //
  6299.     // Interface representing an object that can be notified about state
  6300.     // and other changes within a filter graph. The filtergraph will call plug-in
  6301.     // distributors that expose this optional interface so that they can
  6302.     // respond to appropriate changes.
  6303.     //
  6304.     // Implement if: you are a plug-in distributor (your class id is found
  6305.     // under HKCR\Interface\<IID>\Distributor= for some interface).
  6306.     //
  6307.     // Use if: you are the filtergraph.
  6308.     [
  6309.         object,
  6310.         uuid(56a868af-0ad4-11ce-b03a-0020af0ba770),
  6311.         pointer_default(unique)
  6312.     ]
  6313.     interface IDistributorNotify : IUnknown
  6314.     {
  6315.         // called when graph is entering stop state. Called before
  6316.         // filters are stopped.
  6317.         HRESULT Stop(void);
  6318.  
  6319.         // called when graph is entering paused state, before filters are
  6320.         // notified
  6321.         HRESULT Pause(void);
  6322.  
  6323.         // called when graph is entering running state, before filters are
  6324.         // notified. tStart is the stream-time offset parameter that will be
  6325.         // given to each filter's IBaseFilter::Run method.
  6326.         HRESULT Run(REFERENCE_TIME tStart);
  6327.  
  6328.         // called when the graph's clock is changing, with the new clock. Addref
  6329.         // the clock if you hold it beyond this method. Called before
  6330.         // the filters are notified.
  6331.         HRESULT SetSyncSource(
  6332.             [in] IReferenceClock * pClock);
  6333.  
  6334.         // called when the set of filters or their connections has changed.
  6335.         // Called on every AddFilter, RemoveFilter or ConnectDirect (or anything
  6336.         // that will lead to one of these).
  6337.         // You don't need to rebuild your list of interesting filters at this point
  6338.         // but you should release any refcounts you hold on any filters that
  6339.         // have been removed.
  6340.         HRESULT NotifyGraphChange(void);
  6341.     }
  6342.  
  6343.     typedef enum {
  6344.         AM_STREAM_INFO_START_DEFINED = 0x00000001,
  6345.         AM_STREAM_INFO_STOP_DEFINED  = 0x00000002,
  6346.         AM_STREAM_INFO_DISCARDING    = 0x00000004,
  6347.         AM_STREAM_INFO_STOP_SEND_EXTRA = 0x00000010
  6348.     } AM_STREAM_INFO_FLAGS;
  6349.  
  6350.     //  Stream information
  6351.     typedef struct {
  6352.         REFERENCE_TIME tStart;
  6353.         REFERENCE_TIME tStop;
  6354.         DWORD dwStartCookie;
  6355.         DWORD dwStopCookie;
  6356.         DWORD dwFlags;
  6357.     } AM_STREAM_INFO;
  6358.  
  6359.     //
  6360.     // IAMStreamControl
  6361.     //
  6362.  
  6363.     [
  6364.         object,
  6365.         uuid(36b73881-c2c8-11cf-8b46-00805f6cef60),
  6366.         pointer_default(unique)
  6367.     ]
  6368.     interface IAMStreamControl : IUnknown
  6369.     {
  6370.         // The REFERENCE_TIME pointers may be null, which
  6371.         // indicates immediately.  If the pointer is non-NULL
  6372.         // and dwCookie is non-zero, then pins should send
  6373.         // EC_STREAM_CONTROL_STOPPED / EC_STREAM_CONTROL_STARTED
  6374.         // with an IPin pointer and the cookie, thus allowing
  6375.         // apps to tie the events back to their requests.
  6376.         // If either dwCookies is zero, or the pointer is null,
  6377.         // then no event is sent.
  6378.  
  6379.         // If you have a capture pin hooked up to a MUX input pin and they
  6380.         // both support IAMStreamControl, you'll want the MUX to signal the
  6381.         // stop so you know the last frame was written out.  In order for the
  6382.         // MUX to know it's finished, the capture pin will have to send one
  6383.         // extra sample after it was supposed to stop, so the MUX can trigger
  6384.         // off that.  So you would set bSendExtra to TRUE for the capture pin
  6385.         // Leave it FALSE in all other cases.
  6386.  
  6387.         HRESULT StartAt( [in] const REFERENCE_TIME * ptStart,
  6388.                          [in] DWORD dwCookie );
  6389.         HRESULT StopAt(  [in] const REFERENCE_TIME * ptStop,
  6390.                          [in] BOOL bSendExtra,
  6391.                          [in] DWORD dwCookie );
  6392.         HRESULT GetInfo( [out] AM_STREAM_INFO *pInfo);
  6393.     }
  6394.  
  6395.  
  6396.  
  6397.     //
  6398.     // ISeekingPassThru
  6399.     //
  6400.  
  6401.     [
  6402.         object,
  6403.         uuid(36b73883-c2c8-11cf-8b46-00805f6cef60),
  6404.         pointer_default(unique)
  6405.     ]
  6406.     interface ISeekingPassThru : IUnknown
  6407.     {
  6408.         HRESULT Init(  [in] BOOL bSupportRendering,
  6409.                        [in] IPin *pPin);
  6410.     }
  6411.  
  6412.  
  6413.  
  6414.     //
  6415.     // IAMStreamConfig - pin interface
  6416.     //
  6417.  
  6418.     // A capture filter or compression filter's output pin
  6419.     // supports this interface - no matter what data type you produce.
  6420.  
  6421.     // This interface can be used to set the output format of a pin (as an
  6422.     // alternative to connecting the pin using a specific media type).
  6423.     // After setting an output format, the pin will use that format
  6424.     // the next time it connects to somebody, so you can just Render that
  6425.     // pin and get a desired format without using Connect(CMediaType)
  6426.     // Your pin should do that by ONLY OFFERING the media type set in SetFormat
  6427.     // in its enumeration of media types, and no others.  This will ensure that
  6428.     // that format is indeed used for connection (or at least offer it first).
  6429.     // An application interested in enumerating accepted mediatypes may have to
  6430.     // do so BEFORE calling SetFormat.
  6431.  
  6432.     // But this interface's GetStreamCaps function can get more information
  6433.     // about accepted media types than the traditional way of enumerating a pin's
  6434.     // media types, so it should typically be used instead.
  6435.     // GetStreamCaps gets information about the kinds of formats allowed... how
  6436.     // it can stretch and crop, and the frame rate and data rates allowed (for
  6437.     // video)
  6438.  
  6439.     // VIDEO EXAMPLE
  6440.     //
  6441.     // GetStreamCaps returns a whole array of {MediaType, Capabilities}.
  6442.     // Let's say your capture card supports JPEG anywhere between 160x120 and
  6443.     // 320x240, and also the size 640x480.  Also, say it supports RGB24 at
  6444.     // resolutions between 160x120 and 320x240 but only multiples of 8.  You would
  6445.     // expose these properties by offering a media type of 320 x 240 JPEG
  6446.     // (if that is your default or preferred size) coupled with
  6447.     // capabilities saying minimum 160x120 and maximum 320x240 with granularity of
  6448.     // 1.  The next pair you expose is a media type of 640x480 JPEG coupled with
  6449.     // capabilities of min 640x480 max 640x480.  The third pair is media type
  6450.     // 320x240 RGB24 with capabilities min 160x120 max 320x240 granularity 8.
  6451.     // In this way you can expose almost every quirk your card might have.
  6452.     // An application interested in knowing what compression formats you provide
  6453.     // can get all the pairs and make a list of all the unique sub types of the
  6454.     // media types.
  6455.     //
  6456.     // If a filter's output pin is connected with a media type that has rcSource
  6457.     // and rcTarget not empty, it means the filter is being asked to stretch the
  6458.     // rcSource sub-rectangle of its InputSize (the format of the input pin for
  6459.     // a compressor, and the largest bitmap a capture filter can generate with
  6460.     // every pixel unique) into the rcTarget sub-rectangle of its output format.
  6461.     // For instance, if a video compressor has as input 160x120 RGB, and as output
  6462.     // 320x240 MPEG with an rcSource of (10,10,20,20) and rcTarget of (0,0,100,100)
  6463.     // this means the compressor is being asked to take a 10x10 piece of the 160x120
  6464.     // RGB bitmap, and make it fill the top 100x100 area of a 320x240 bitmap,
  6465.     // leaving the rest of the 320x240 bitmap untouched.
  6466.     // A filter does not have to support this and can fail to connect with a
  6467.     // media type where rcSource and rcTarget are not empty.
  6468.     //
  6469.     // Your output pin is connected to the next filter with a certain media
  6470.     // type (either directly or using the media type passed by SetFormat),
  6471.     // and you need to look at the AvgBytesPerSecond field of the format
  6472.     // of that mediatype to see what data rate you are being asked to compress
  6473.     // the video to, and use that data rate.  Using the number of frames per
  6474.     // second in AvgTimePerFrame, you can figure out how many bytes each frame
  6475.     // is supposed to be.  You can make it smaller, but NEVER EVER make a bigger
  6476.     // data rate.  For a video compressor, your input pin's media type tells you
  6477.     // the frame rate (use that AvgTimePerFrame).  For a capture filter, the
  6478.     // output media type tells you, so use that AvgTimePerFrame.
  6479.     //
  6480.     // The cropping rectangle described below is the same as the rcSrc of the
  6481.     // output pin's media type.
  6482.     //
  6483.     // The output rectangle described below is the same of the width and height
  6484.     // of the BITMAPINFOHEADER of the media type of the output pin's media type
  6485.  
  6486.  
  6487.     // AUDIO EXAMPLE
  6488.     //
  6489.     // This API can return an array of pairs of (media type, capabilities).
  6490.     // This can be used to expose all kinds of wierd capabilities.  Let's say you
  6491.     // do any PCM frequency from 11,025 to 44,100 at 8 or 16 bit mono or
  6492.     // stereo, and you also do 48,000 16bit stereo as a special combination.
  6493.     // You would expose 3 pairs.  The first pair would have Min Freq of 11025 and
  6494.     // Max Freq of 44100, with MaxChannels=2 and MinBits=8 and MaxBits=8 for the
  6495.     // capabilites structure, and a media type of anything you like, maybe
  6496.     // 22kHz, 8bit stereo as a default.
  6497.     // The 2nd pair would be the same except for MinBits=16 and MaxBits=16 in
  6498.     // the capabilities structure and the media type could be something like
  6499.     // 44kHz, 16bit stereo as a default (the media type in the pair should always
  6500.     // be something legal as described by the capabilities structure... the
  6501.     // structure tells you how you can change the media type to produce other
  6502.     // legal media types... for instance changing 44kHz to 29010Hz would be legal,
  6503.     // but changing bits from 16 to 14 would not be.)
  6504.     // The 3rd pair would be MinFreq=48000 MaxFreq=48000 MaxChannels=2
  6505.     // MinBits=16 and MaxBits=16, and the media type would be 48kHz 16bit stereo.
  6506.     // You can also use the Granularity elements of the structure (like the example
  6507.     // for video) if you support values that multiples of n, eg.  you could say
  6508.     // minimum bits per sample 8, max 16, and granularity 8 to describe doing
  6509.     // either 8 or 16 bit all in one structure
  6510.     //
  6511.     // If you support non-PCM formats, the media type returned in GetStreamCaps
  6512.     // can show which non-PCM formats you support (with a default sample rate,
  6513.     // bit rate and channels) and the capabilities structure going with that
  6514.     // media type can describe which other sample rates, bit rates and channels
  6515.     // you support.
  6516.  
  6517.     [
  6518.         object,
  6519.         uuid(C6E13340-30AC-11d0-A18C-00A0C9118956),
  6520.         pointer_default(unique)
  6521.     ]
  6522.     interface IAMStreamConfig : IUnknown
  6523.     {
  6524.  
  6525.         // this is the structure returned by a VIDEO filter
  6526.         //
  6527.         typedef struct _VIDEO_STREAM_CONFIG_CAPS {
  6528.  
  6529.         GUID        guid;   // will be MEDIATYPE_Video
  6530.  
  6531.         // the logical or of all the AnalogVideoStandard's supported
  6532.         // typically zero if not supported
  6533.         ULONG       VideoStandard;
  6534.  
  6535.         // the inherent size of the incoming signal... taken from the input
  6536.         // pin for a compressor, or the largest size a capture filter can
  6537.         // digitize the signal with every pixel still unique
  6538.             SIZE        InputSize;
  6539.  
  6540.         // The input of a compressor filter may have to be connected for these
  6541.         // to be known
  6542.  
  6543.         // smallest rcSrc cropping rect allowed
  6544.             SIZE        MinCroppingSize;
  6545.         // largest rcSrc cropping rect allowed
  6546.             SIZE        MaxCroppingSize;
  6547.         // granularity of cropping size - eg only widths a multiple of 4 allowed
  6548.             int         CropGranularityX;
  6549.             int         CropGranularityY;
  6550.         // alignment of cropping rect - eg rect must start on multiple of 4
  6551.         int     CropAlignX;
  6552.         int     CropAlignY;
  6553.  
  6554.         // The input of a compressor filter may have to be connected for these
  6555.         // to be known
  6556.  
  6557.         // smallest bitmap this pin can produce
  6558.             SIZE        MinOutputSize;
  6559.         // largest bitmap this pin can produce
  6560.             SIZE        MaxOutputSize;
  6561.         // granularity of output bitmap size
  6562.             int         OutputGranularityX;
  6563.             int         OutputGranularityY;
  6564.         // !!! what about alignment of rcTarget inside BIH if different?
  6565.  
  6566.         // how well can you stretch in the x direction?  0==not at all
  6567.         // 1=pixel doubling 2=interpolation(2 taps) 3=better interpolation
  6568.         // etc.
  6569.         int     StretchTapsX;
  6570.         int     StretchTapsY;
  6571.         // how well can you shrink in the x direction?  0==not at all
  6572.         // 1=pixel doubling 2=interpolation(2 taps) 3=better interpolation
  6573.         // etc.
  6574.         int     ShrinkTapsX;
  6575.         int     ShrinkTapsY;
  6576.  
  6577.         // CAPTURE filter only - what frame rates are allowed?
  6578.             LONGLONG    MinFrameInterval;
  6579.             LONGLONG    MaxFrameInterval;
  6580.  
  6581.         // what data rates can this pin produce?
  6582.             LONG        MinBitsPerSecond;
  6583.             LONG        MaxBitsPerSecond;
  6584.         } VIDEO_STREAM_CONFIG_CAPS;
  6585.  
  6586.  
  6587.         // this is the structure returned by an AUDIO filter
  6588.         //
  6589.         typedef struct _AUDIO_STREAM_CONFIG_CAPS {
  6590.  
  6591.         GUID       guid;    // will be MEDIATYPE_Audio
  6592.         ULONG      MinimumChannels;
  6593.         ULONG      MaximumChannels;
  6594.         ULONG      ChannelsGranularity;
  6595.         ULONG      MinimumBitsPerSample;
  6596.         ULONG      MaximumBitsPerSample;
  6597.         ULONG      BitsPerSampleGranularity;
  6598.         ULONG      MinimumSampleFrequency;
  6599.         ULONG      MaximumSampleFrequency;
  6600.         ULONG      SampleFrequencyGranularity;
  6601.         } AUDIO_STREAM_CONFIG_CAPS;
  6602.  
  6603.         // - only allowed when pin is not streaming, else the call will FAIL
  6604.         // - If your output pin is not yet connected, and you can
  6605.         //   connect your output pin with this media type, you should
  6606.         //   succeed the call, and start offering it first (enumerate as format#0)
  6607.         //   from GetMediaType so that this format will be used to connect with
  6608.         //   when you do connect to somebody
  6609.         // - if your output pin is already connected, and you can provide this
  6610.         //   type, reconnect your pin.  If the other pin can't accept it, FAIL
  6611.         //   this call and leave your connection alone.
  6612.         HRESULT SetFormat(
  6613.                 [in] AM_MEDIA_TYPE *pmt);
  6614.  
  6615.         // the format it's connected with, or will connect with
  6616.         // the application is responsible for calling DeleteMediaType(*ppmt);
  6617.         HRESULT GetFormat(
  6618.                 [out] AM_MEDIA_TYPE **ppmt);
  6619.  
  6620.         // how many different Stream Caps structures are there?
  6621.         // also, how big is the stream caps structure?
  6622.         HRESULT GetNumberOfCapabilities(
  6623.                 [out] int *piCount,
  6624.                 [out] int *piSize); // pSCC of GetStreamCaps needs to be this big
  6625.  
  6626.         // - gets one of the pairs of {Mediatype, Caps}
  6627.         // - return S_FALSE if iIndex is too high
  6628.         // - the application is responsible for calling DeleteMediaType(*ppmt);
  6629.         // - the first thing pSCC points to is a GUID saying MEDIATYPE_Video
  6630.         //   or MEDIATYPE_Audio, so you can tell if you have a pointer to a
  6631.         //   VIDEO_STREAM_CONFIG_CAPS or an AUDIO_STREAM_CONFIG_CAPS structure
  6632.         //   There could potentially be many more possibilities other than video
  6633.         //   or audio.
  6634.         HRESULT GetStreamCaps(
  6635.                 [in]  int iIndex,   // 0 to #caps-1
  6636.                 [out] AM_MEDIA_TYPE **ppmt,
  6637.                 [out] BYTE *pSCC);
  6638.  
  6639.     }
  6640.  
  6641.  
  6642.  
  6643.     // Interface to control interleaving of different streams in one file
  6644.     [
  6645.     object,
  6646.     uuid(BEE3D220-157B-11d0-BD23-00A0C911CE86),
  6647.     pointer_default(unique)
  6648.     ]
  6649.     interface IConfigInterleaving : IUnknown
  6650.     {
  6651.         import "unknwn.idl";
  6652.  
  6653.         typedef enum
  6654.         {
  6655.             // uninterleaved - samples written out in the order they
  6656.             // arrive
  6657.             INTERLEAVE_NONE,
  6658.  
  6659.             // approximate interleaving with less overhead for video
  6660.             // capture
  6661.             INTERLEAVE_CAPTURE,
  6662.  
  6663.             // full, precise interleaving. slower.
  6664.             INTERLEAVE_FULL
  6665.  
  6666.         } InterleavingMode;
  6667.  
  6668.         HRESULT put_Mode(
  6669.             [in] InterleavingMode mode
  6670.             );
  6671.  
  6672.         HRESULT get_Mode(
  6673.             [out] InterleavingMode *pMode
  6674.             );
  6675.  
  6676.         HRESULT put_Interleaving(
  6677.             [in] const REFERENCE_TIME *prtInterleave,
  6678.             [in] const REFERENCE_TIME *prtPreroll
  6679.             );
  6680.  
  6681.         HRESULT get_Interleaving(
  6682.             [out] REFERENCE_TIME *prtInterleave,
  6683.             [out] REFERENCE_TIME *prtPreroll
  6684.             );
  6685.     }
  6686.  
  6687.     // Interface to control the AVI mux
  6688.     [
  6689.     object,
  6690.     uuid(5ACD6AA0-F482-11ce-8B67-00AA00A3F1A6),
  6691.     pointer_default(unique)
  6692.     ]
  6693.     interface IConfigAviMux : IUnknown
  6694.     {
  6695.         import "unknwn.idl";
  6696.  
  6697.         // control whether the AVI mux adjusts the frame rate or audio
  6698.         // sampling rate for drift when the file is closed. -1 to disables
  6699.         // this behavior.
  6700.         HRESULT SetMasterStream([in] LONG iStream);
  6701.         HRESULT GetMasterStream([out] LONG *pStream);
  6702.  
  6703.         // control whether the AVI mux writes out an idx1 index chunk for
  6704.         // compatibility with older AVI players.
  6705.         HRESULT SetOutputCompatibilityIndex([in] BOOL fOldIndex);
  6706.         HRESULT GetOutputCompatibilityIndex([out] BOOL *pfOldIndex);
  6707.     }
  6708.  
  6709.         //---------------------------------------------------------------------
  6710.         //  CompressionCaps enum
  6711.         //---------------------------------------------------------------------
  6712.  
  6713.         // This tells you which features of IAMVideoCompression are supported
  6714.  
  6715.         // CanCrunch means that it can compress video to a specified data rate
  6716.         // If so, then the output pin's media type will contain that data rate
  6717.         // in the format's AvgBytesPerSecond field, and that should be used.
  6718.  
  6719.         typedef enum
  6720.         {
  6721.             CompressionCaps_CanQuality =  0x01,
  6722.             CompressionCaps_CanCrunch =   0x02,
  6723.             CompressionCaps_CanKeyFrame = 0x04,
  6724.             CompressionCaps_CanBFrame =   0x08,
  6725.             CompressionCaps_CanWindow =   0x10
  6726.         } CompressionCaps;
  6727.  
  6728.  
  6729.  
  6730.         //---------------------------------------------------------------------
  6731.         // IAMVideoCompression interface
  6732.         //
  6733.         // Control compression parameters - pin interface
  6734.         //---------------------------------------------------------------------
  6735.  
  6736.         // This interface is implemented by the output pin of a video capture
  6737.         // filter or video compressor that provides video data
  6738.  
  6739.         // You use this interface to control how video is compressed... how
  6740.         // many keyframes, etc., and to find information like capabilities and
  6741.         // the description of this compressor
  6742.  
  6743.         [
  6744.         object,
  6745.             uuid(C6E13343-30AC-11d0-A18C-00A0C9118956),
  6746.             pointer_default(unique)
  6747.         ]
  6748.         interface IAMVideoCompression : IUnknown
  6749.         {
  6750.         // - Only valid if GetInfo's pCapabilities sets
  6751.         //   CompressionCaps_CanKeyFrame
  6752.         // - KeyFrameRate < 0 means use the compressor default
  6753.         // - KeyFrames == 0 means only the first frame is a key
  6754.             HRESULT put_KeyFrameRate (
  6755.                         [in] long KeyFrameRate);
  6756.  
  6757.             HRESULT get_KeyFrameRate (
  6758.                         [out] long * pKeyFrameRate);
  6759.  
  6760.         // - Only valid if GetInfo's pCapabilities sets
  6761.         //   CompressionCaps_CanBFrame
  6762.         // - If keyframes are every 10, and there are 3 P Frames per key,
  6763.         //   they will be spaced evenly between the key frames and the other
  6764.         //   6 frames will be B frames
  6765.         // - PFramesPerKeyFrame < 0 means use the compressor default
  6766.             HRESULT put_PFramesPerKeyFrame (
  6767.                         [in] long PFramesPerKeyFrame);
  6768.  
  6769.             HRESULT get_PFramesPerKeyFrame (
  6770.                         [out] long * pPFramesPerKeyFrame);
  6771.  
  6772.         // - Only valid if GetInfo's pCapabilities sets
  6773.         //   CompressionCaps_CanQuality
  6774.         // - Controls image quality
  6775.         // - If you are compressing to a fixed data rate, a high quality
  6776.         //   means try and use all of the data rate, and a low quality means
  6777.         //   feel free to use much lower than the data rate if you want to.
  6778.         // - Quality < 0 means use the compressor default
  6779.             HRESULT put_Quality (
  6780.                         [in] double Quality);
  6781.  
  6782.             HRESULT get_Quality (
  6783.                         [out] double * pQuality);
  6784.  
  6785.         // If you have set a data rate of 100K/sec on a 10fps movie, that
  6786.         // will normally mean each frame must be <=10K.  But a window size
  6787.         // means every consecutive n frames must average to the data rate,
  6788.         // but an individual frame (if n > 1) is allowed to exceed the
  6789.         // frame size suggested by the data rate
  6790.             HRESULT put_WindowSize (
  6791.                         [in] DWORDLONG WindowSize);
  6792.  
  6793.             HRESULT get_WindowSize (
  6794.                         [out] DWORDLONG * pWindowSize);
  6795.  
  6796.         // - pszVersion might be "Version 2.1.0"
  6797.         // - pszDescription might be "Danny's awesome video compressor"
  6798.         // - pcbVersion and pcbDescription will be filled in with the
  6799.         //   required length if they are too short
  6800.         // - *pCapabilities is a logical OR of some CompressionCaps flags
  6801.             HRESULT GetInfo(
  6802.                         [out, size_is(*pcbVersion)] WCHAR * pszVersion,
  6803.                         [in,out] int *pcbVersion,
  6804.                         [out, size_is(*pcbDescription)] LPWSTR pszDescription,
  6805.                         [in,out] int *pcbDescription,
  6806.                         [out] long *pDefaultKeyFrameRate,
  6807.                         [out] long *pDefaultPFramesPerKey,
  6808.                         [out] double *pDefaultQuality,
  6809.                         [out] long *pCapabilities  //CompressionCaps
  6810.             );
  6811.  
  6812.         // - this means when this frame number comes along after the graph
  6813.         //   is running, make it a keyframe even if you weren't going to
  6814.             HRESULT OverrideKeyFrame(
  6815.                         [in]  long FrameNumber
  6816.             );
  6817.  
  6818.         // - Only valid if GetInfo's pCapabilities sets
  6819.         //   CompressionCaps_CanCrunch
  6820.         // - this means when this frame number comes along after the graph
  6821.         //   is running, make it this many bytes big instead of whatever size
  6822.         //   you were going to make it.
  6823.             HRESULT OverrideFrameSize(
  6824.                         [in]  long FrameNumber,
  6825.                         [in]  long Size
  6826.             );
  6827.  
  6828.         }
  6829.  
  6830.         //---------------------------------------------------------------------
  6831.         //  VfwCaptureDialogs enum
  6832.         //---------------------------------------------------------------------
  6833.  
  6834.         typedef enum
  6835.         {
  6836.              VfwCaptureDialog_Source = 0x01,
  6837.              VfwCaptureDialog_Format = 0x02,
  6838.              VfwCaptureDialog_Display = 0x04
  6839.         } VfwCaptureDialogs;
  6840.  
  6841.  
  6842.         //---------------------------------------------------------------------
  6843.         //  VfwCompressDialogs enum
  6844.         //---------------------------------------------------------------------
  6845.  
  6846.         typedef enum
  6847.         {
  6848.              VfwCompressDialog_Config = 0x01,
  6849.              VfwCompressDialog_About =  0x02,
  6850.              // returns S_OK if the dialog exists and can be shown, else S_FALSE
  6851.              VfwCompressDialog_QueryConfig = 0x04,
  6852.              VfwCompressDialog_QueryAbout =  0x08
  6853.         } VfwCompressDialogs;
  6854.  
  6855.  
  6856.         //---------------------------------------------------------------------
  6857.         // IAMVfwCaptureDialogs - filter interface
  6858.         //
  6859.         // Show a VfW capture driver dialog - SOURCE, FORMAT, or DISPLAY
  6860.         //---------------------------------------------------------------------
  6861.  
  6862.         // This interface is supported only by Microsoft's Video For Windows
  6863.         // capture driver Capture Filter.  It allows an application to bring up
  6864.         // one of the 3 driver dialogs that VfW capture drivers have.
  6865.  
  6866.         [
  6867.         object,
  6868.             local,
  6869.             uuid(D8D715A0-6E5E-11D0-B3F0-00AA003761C5),
  6870.             pointer_default(unique)
  6871.         ]
  6872.         interface IAMVfwCaptureDialogs : IUnknown
  6873.         {
  6874.             HRESULT HasDialog(
  6875.                         [in]  int iDialog   // VfwCaptureDialogs enum
  6876.             );
  6877.  
  6878.             HRESULT ShowDialog(
  6879.                         [in]  int iDialog,  // VfwCaptureDialogs enum
  6880.                 [in]  HWND hwnd
  6881.             );
  6882.  
  6883.             HRESULT SendDriverMessage(
  6884.                         [in]  int iDialog,  // VfwCaptureDialogs enum
  6885.                         [in]  int uMsg,
  6886.                         [in]  long dw1,
  6887.                         [in]  long dw2
  6888.             );
  6889.  
  6890.         // - iDialog can be one of the VfwCaptureDialogs enums
  6891.         // - HasDialog returns S_OK if it has the dialog, else S_FALSE
  6892.         // - ShowDialog can only be called when not streaming or when another
  6893.         //   dialog is not already up
  6894.         // - SendDriverMessage can send a secret message to the capture driver.
  6895.         //   USE IT AT YOUR OWN RISK!
  6896.         }
  6897.  
  6898.         //---------------------------------------------------------------------
  6899.         // IAMVfwCompressDialogs - filter interface
  6900.         //
  6901.         // Show a VfW codec driver dialog - CONFIG or ABOUT
  6902.         //---------------------------------------------------------------------
  6903.  
  6904.         // This interface is supported only by Microsoft's ICM Compressor filter
  6905.         // (Co).  It allows an application to bring up either the Configure or
  6906.         // About dialogs for the ICM codec that it is currently using.
  6907.  
  6908.         [
  6909.         object,
  6910.         local,
  6911.             uuid(D8D715A3-6E5E-11D0-B3F0-00AA003761C5),
  6912.             pointer_default(unique)
  6913.         ]
  6914.         interface IAMVfwCompressDialogs : IUnknown
  6915.         {
  6916.  
  6917.             // Bring up a dialog for this codec
  6918.             HRESULT ShowDialog(
  6919.                 [in]  int iDialog,   // VfwCompressDialogs enum
  6920.                 [in]  HWND hwnd
  6921.             );
  6922.  
  6923.             // Calls ICGetState and gives you the result
  6924.             HRESULT GetState(
  6925.                 [out, size_is(*pcbState)] LPVOID pState,
  6926.                 [in, out]  int *pcbState
  6927.             );
  6928.  
  6929.             // Calls ICSetState
  6930.             HRESULT SetState(
  6931.                 [in, size_is(cbState)] LPVOID pState,
  6932.                 [in]  int cbState
  6933.             );
  6934.  
  6935.             // Send a codec specific message
  6936.             HRESULT SendDriverMessage(
  6937.                 [in]  int uMsg,
  6938.                 [in]  long dw1,
  6939.                 [in]  long dw2
  6940.             );
  6941.  
  6942.         // - iDialog can be one of the VfwCaptureDialogs enums
  6943.         // - ShowDialog can only be called when not streaming or when no other
  6944.         //   dialog is up already
  6945.         // - an application can call GetState after ShowDialog(CONFIG) to
  6946.         //   see how the compressor was configured and next time the graph
  6947.         //   is used, it can call SetState with the data it saved to return
  6948.         //   the codec to the state configured by the dialog box from last time
  6949.         // - GetState with a NULL pointer returns the size needed
  6950.         // - SendDriverMessage can send a secret message to the codec.
  6951.         //   USE IT AT YOUR OWN RISK!
  6952.         }
  6953.  
  6954.  
  6955.         //---------------------------------------------------------------------
  6956.         // IAMDroppedFrames interface
  6957.         //
  6958.         // Report status of capture - pin interface
  6959.         //---------------------------------------------------------------------
  6960.  
  6961.         // A capture filter's video output pin supports this.  It reports
  6962.         // how many frames were not sent (dropped), etc.
  6963.  
  6964.         // Every time your filter goes from STOPPED-->PAUSED, you reset all your
  6965.         // counts to zero.
  6966.  
  6967.         // An app may call this all the time while you are capturing to see how
  6968.         // capturing is going.  MAKE SURE you always return as current information
  6969.         // as possible while you are running.
  6970.  
  6971.         // When your capture filter starts running, it starts by sending frame 0,
  6972.         // then 1, 2, 3, etc.  The time stamp of each frame sent should correspond
  6973.         // to the graph clock's time when the image was digitized.  The end time
  6974.         // is the start time plus the duration of the video frame.
  6975.         // You should also set the MediaTime of each sample (SetMediaTime) as well.
  6976.         // This should be the frame number ie (0,1) (1,2) (2,3).
  6977.         // If a frame is dropped, a downstream filter will be able to tell easily
  6978.         // not by looking for gaps in the regular time stamps, but by noticing a
  6979.         // frame number is missing (eg.  (1,2) (2,3) (4,5) (5,6) means frame 3
  6980.         // was dropped.
  6981.  
  6982.         // Using the info provided by this interface, an application can figure out
  6983.         // the number of frames dropped, the frame rate achieved (the length of
  6984.         // time the graph was running divided by the number of frames not dropped),
  6985.         // and the data rate acheived (the length of time the graph was running
  6986.         // divided by the average frame size).
  6987.  
  6988.         // If your filter is running, then paused, and then run again, you need
  6989.         // to continue to deliver frames as if it was never paused.  The first
  6990.         // frame after the second RUN cannot be time stamped earlier than the last
  6991.         // frame sent before the pause.
  6992.  
  6993.         // Your filter must always increment the MediaTime of each sample sent.
  6994.         // Never send the same frame # twice, and never go back in time.  The
  6995.         // regular time stamp of a sample can also never go back in time.
  6996.  
  6997.         [
  6998.         object,
  6999.             uuid(C6E13344-30AC-11d0-A18C-00A0C9118956),
  7000.             pointer_default(unique)
  7001.         ]
  7002.         interface IAMDroppedFrames : IUnknown
  7003.         {
  7004.             // Get the number of dropped frames
  7005.             HRESULT GetNumDropped(
  7006.                         [out]  long * plDropped
  7007.  
  7008.             );
  7009.  
  7010.             //Get the number of non-dropped frames
  7011.             HRESULT GetNumNotDropped(
  7012.                         [out]  long * plNotDropped
  7013.  
  7014.             );
  7015.  
  7016.         // - plArray points to an array of lSize longs.  The filter will
  7017.         //   fill it with the frame number of the first lSize frames dropped.
  7018.         //   A filter may not have bothered to remember as many as you asked
  7019.         //   for, so it will set *plNumCopied to the number of frames it filled
  7020.         //   in.
  7021.             HRESULT GetDroppedInfo(
  7022.                         [in]   long lSize,
  7023.                         [out]  long * plArray,
  7024.                         [out]  long *  plNumCopied
  7025.             );
  7026.  
  7027.         // - This is the average size of the frames it didn't drop (in bytes)
  7028.             HRESULT GetAverageFrameSize(
  7029.                         [out]  long * plAverageSize
  7030.  
  7031.             );
  7032.  
  7033.         }
  7034.  
  7035.  
  7036.  
  7037.         cpp_quote("#define AMF_AUTOMATICGAIN -1.0")
  7038.  
  7039.         //---------------------------------------------------------------------
  7040.         // IAMAudioInputMixer interface
  7041.         //
  7042.         // Sets the recording levels, pan and EQ for the audio card inputs
  7043.         //---------------------------------------------------------------------
  7044.  
  7045.         // This interface is implemented by each input pin of an audio capture
  7046.         // filter, to tell it what level, panning, and EQ to use for each input.
  7047.         // The name of each pin will reflect the type of input, eg. "Line input 1"
  7048.         // or "Mic".  An application uses the pin names to decide how it wants to
  7049.         // set the recording levels
  7050.  
  7051.         // This interface can also be supported by the audio capture filter itself
  7052.         // to control to overall record level and panning after the mix
  7053.  
  7054.         [
  7055.         object,
  7056.             uuid(54C39221-8380-11d0-B3F0-00AA003761C5),
  7057.             pointer_default(unique)
  7058.         ]
  7059.         interface IAMAudioInputMixer : IUnknown
  7060.         {
  7061.         // This interface is only supported by the input pins, not the filter
  7062.         // If disabled, this channel will not be mixed in as part of the
  7063.         // recorded signal.
  7064.             HRESULT put_Enable (
  7065.                 [in] BOOL fEnable); // TRUE=enable FALSE=disable
  7066.  
  7067.         //Is this channel enabled?
  7068.             HRESULT get_Enable (
  7069.                 [out] BOOL *pfEnable);
  7070.  
  7071.         // When set to mono mode, making a stereo recording of this channel
  7072.         // will have both channels contain the same data... a mixture of the
  7073.         // left and right signals
  7074.             HRESULT put_Mono (
  7075.                         [in] BOOL fMono);   // TRUE=mono FALSE=multi channel
  7076.  
  7077.             //all channels combined into a mono signal?
  7078.             HRESULT get_Mono (
  7079.                         [out] BOOL *pfMono);
  7080.  
  7081.         // !!! WILL CARDS BE ABLE TO BOOST THE GAIN?
  7082.             //Set the record level for this channel
  7083.             HRESULT put_MixLevel (
  7084.                         [in] double Level); // 0 = off, 1 = full (unity?) volume
  7085.                         // AMF_AUTOMATICGAIN, if supported,
  7086.                         // means automatic
  7087.  
  7088.             //Get the record level for this channel
  7089.             HRESULT get_MixLevel (
  7090.                         [out] double *pLevel);
  7091.  
  7092.         // For instance, when panned full left, and you make a stereo recording
  7093.         // of this channel, you will record a silent right channel.
  7094.             HRESULT put_Pan (
  7095.                         [in] double Pan);   // -1 = full left, 0 = centre, 1 = right
  7096.  
  7097.             //Get the pan for this channel
  7098.             HRESULT get_Pan (
  7099.                         [out] double *pPan);
  7100.  
  7101.         // Boosts the bass of low volume signals before they are recorded
  7102.         // to compensate for the fact that your ear has trouble hearing quiet
  7103.         // bass sounds
  7104.             HRESULT put_Loudness (
  7105.                         [in] BOOL fLoudness);// TRUE=on FALSE=off
  7106.  
  7107.             HRESULT get_Loudness (
  7108.                         [out] BOOL *pfLoudness);
  7109.  
  7110.         // boosts or cuts the treble of the signal before it's recorded by
  7111.         // a certain amount of dB
  7112.             HRESULT put_Treble (
  7113.                         [in] double Treble); // gain in dB (-ve = attenuate)
  7114.  
  7115.             //Get the treble EQ for this channel
  7116.             HRESULT get_Treble (
  7117.                         [out] double *pTreble);
  7118.  
  7119.         // This is the maximum value allowed in put_Treble.  ie 6.0 means
  7120.         // any value between -6.0 and 6.0 is allowed
  7121.             HRESULT get_TrebleRange (
  7122.                         [out] double *pRange); // largest value allowed
  7123.  
  7124.         // boosts or cuts the bass of the signal before it's recorded by
  7125.         // a certain amount of dB
  7126.             HRESULT put_Bass (
  7127.                         [in] double Bass); // gain in dB (-ve = attenuate)
  7128.  
  7129.             // Get the bass EQ for this channel
  7130.             HRESULT get_Bass (
  7131.                         [out] double *pBass);
  7132.  
  7133.         // This is the maximum value allowed in put_Bass.  ie 6.0 means
  7134.         // any value between -6.0 and 6.0 is allowed
  7135.             HRESULT get_BassRange (
  7136.                         [out] double *pRange); // largest value allowed
  7137.  
  7138.         }
  7139.  
  7140.  
  7141.         //---------------------------------------------------------------------
  7142.         // IAMBufferNegotiation interface
  7143.         //
  7144.         // Tells a pin what kinds of buffers to use when connected
  7145.         //---------------------------------------------------------------------
  7146.  
  7147.         // This interface can be implemented by any pin that will connect to
  7148.         // another pin using IMemInputPin.  All capture filters should support
  7149.         // this interface.
  7150.  
  7151.         // SuggestAllocatorProperties is a way for an application to get
  7152.         // in on the buffer negotiation process for a pin.  This pin will use
  7153.         // the numbers given to it by the application as its request to the
  7154.         // allocator.  An application can use a negative number for any element
  7155.         // in the ALLOCATOR_PROPERTIES to mean "don't care".  An application must
  7156.         // call this function before the pin is connected, or it will be too late
  7157.         // To ensure that an application gets what it wants, it would be wise to
  7158.         // call this method on both pins being connected together, so the other
  7159.         // pin doesn't overrule the application's request.
  7160.  
  7161.         // GetAllocatorProperties can only be called after a pin is connected and
  7162.         // it returns the properties of the current allocator being used
  7163.  
  7164.         [
  7165.         object,
  7166.             uuid(56ED71A0-AF5F-11D0-B3F0-00AA003761C5),
  7167.             pointer_default(unique)
  7168.         ]
  7169.         interface IAMBufferNegotiation : IUnknown
  7170.         {
  7171.             HRESULT SuggestAllocatorProperties (
  7172.                 [in] const ALLOCATOR_PROPERTIES *pprop);
  7173.  
  7174.             HRESULT GetAllocatorProperties (
  7175.                 [out] ALLOCATOR_PROPERTIES *pprop);
  7176.  
  7177.         }
  7178.  
  7179.  
  7180.         //---------------------------------------------------------------------
  7181.         // AnalogVideoStandard enum
  7182.         //---------------------------------------------------------------------
  7183.  
  7184.         typedef enum tagAnalogVideoStandard
  7185.         {
  7186.             AnalogVideo_None     = 0x00000000,  // This is a digital sensor
  7187.             AnalogVideo_NTSC_M   = 0x00000001,  //        75 IRE Setup
  7188.             AnalogVideo_NTSC_M_J = 0x00000002,  // Japan,  0 IRE Setup
  7189.             AnalogVideo_NTSC_433 = 0x00000004,
  7190.  
  7191.             AnalogVideo_PAL_B    = 0x00000010,
  7192.             AnalogVideo_PAL_D    = 0x00000020,
  7193.             AnalogVideo_PAL_G    = 0x00000040,
  7194.             AnalogVideo_PAL_H    = 0x00000080,
  7195.             AnalogVideo_PAL_I    = 0x00000100,
  7196.             AnalogVideo_PAL_M    = 0x00000200,
  7197.             AnalogVideo_PAL_N    = 0x00000400,
  7198.  
  7199.             AnalogVideo_PAL_60   = 0x00000800,
  7200.  
  7201.             AnalogVideo_SECAM_B  = 0x00001000,
  7202.             AnalogVideo_SECAM_D  = 0x00002000,
  7203.             AnalogVideo_SECAM_G  = 0x00004000,
  7204.             AnalogVideo_SECAM_H  = 0x00008000,
  7205.             AnalogVideo_SECAM_K  = 0x00010000,
  7206.             AnalogVideo_SECAM_K1 = 0x00020000,
  7207.             AnalogVideo_SECAM_L  = 0x00040000,
  7208.             AnalogVideo_SECAM_L1 = 0x00080000,
  7209.  
  7210.             AnalogVideo_PAL_N_COMBO             // Argentina
  7211.                                  = 0x00100000
  7212.         } AnalogVideoStandard;
  7213.  
  7214.         cpp_quote("#define AnalogVideo_NTSC_Mask  0x00000007")
  7215.         cpp_quote("#define AnalogVideo_PAL_Mask   0x00100FF0")
  7216.         cpp_quote("#define AnalogVideo_SECAM_Mask 0x000FF000")
  7217.  
  7218.  
  7219.         //---------------------------------------------------------------------
  7220.         // TunerInputType enum
  7221.         //---------------------------------------------------------------------
  7222.  
  7223.         typedef enum tagTunerInputType
  7224.         {
  7225.             TunerInputCable,
  7226.             TunerInputAntenna
  7227.         } TunerInputType;
  7228.  
  7229.         //---------------------------------------------------------------------
  7230.         // VideoCopyProtectionType enum
  7231.         //---------------------------------------------------------------------
  7232.  
  7233.         typedef enum
  7234.         {
  7235.             VideoCopyProtectionMacrovisionBasic,
  7236.             VideoCopyProtectionMacrovisionCBI
  7237.         } VideoCopyProtectionType;
  7238.  
  7239.         //---------------------------------------------------------------------
  7240.         // PhysicalConnectorType enum
  7241.         //---------------------------------------------------------------------
  7242.  
  7243.         typedef enum tagPhysicalConnectorType
  7244.         {
  7245.             PhysConn_Video_Tuner = 1,
  7246.             PhysConn_Video_Composite,
  7247.             PhysConn_Video_SVideo,
  7248.             PhysConn_Video_RGB,
  7249.             PhysConn_Video_YRYBY,
  7250.             PhysConn_Video_SerialDigital,
  7251.             PhysConn_Video_ParallelDigital,
  7252.             PhysConn_Video_SCSI,
  7253.             PhysConn_Video_AUX,
  7254.             PhysConn_Video_1394,
  7255.             PhysConn_Video_USB,
  7256.             PhysConn_Video_VideoDecoder,
  7257.             PhysConn_Video_VideoEncoder,
  7258.             PhysConn_Video_SCART,
  7259.             PhysConn_Video_Black,           
  7260.  
  7261.  
  7262.             PhysConn_Audio_Tuner = 0x1000,
  7263.             PhysConn_Audio_Line,
  7264.             PhysConn_Audio_Mic,
  7265.             PhysConn_Audio_AESDigital,
  7266.             PhysConn_Audio_SPDIFDigital,
  7267.             PhysConn_Audio_SCSI,
  7268.             PhysConn_Audio_AUX,
  7269.             PhysConn_Audio_1394,
  7270.             PhysConn_Audio_USB,
  7271.             PhysConn_Audio_AudioDecoder,
  7272.         } PhysicalConnectorType;
  7273.  
  7274.  
  7275.  
  7276.  
  7277.         //---------------------------------------------------------------------
  7278.         // IAMAnalogVideoDecoder interface
  7279.         //---------------------------------------------------------------------
  7280.  
  7281.         [
  7282.         object,
  7283.             uuid(C6E13350-30AC-11d0-A18C-00A0C9118956),
  7284.         pointer_default(unique)
  7285.         ]
  7286.         interface IAMAnalogVideoDecoder : IUnknown
  7287.         {
  7288.  
  7289.              //Gets the supported analog video standards (NTSC/M, PAL/B, SECAM/K1...
  7290.             HRESULT get_AvailableTVFormats(
  7291.                         [out] long *lAnalogVideoStandard
  7292.                         );
  7293.  
  7294.             //Sets or gets the current analog video standard (NTSC/M, PAL/B, SECAM/K1, ...
  7295.             HRESULT put_TVFormat(
  7296.                         [in] long lAnalogVideoStandard
  7297.                         );
  7298.  
  7299.             // Sets or gets the current analog video standard (NTSC/M, PAL/B, SECAM/K1, ...
  7300.             HRESULT get_TVFormat(
  7301.                         [out] long * plAnalogVideoStandard
  7302.                         );
  7303.  
  7304.             // True if horizontal sync is locked
  7305.             HRESULT get_HorizontalLocked (
  7306.                         [out] long * plLocked);
  7307.  
  7308.             // True if connected to a VCR (changes PLL timing)
  7309.             HRESULT put_VCRHorizontalLocking (
  7310.                         [in] long lVCRHorizontalLocking);
  7311.  
  7312.             HRESULT get_VCRHorizontalLocking (
  7313.                         [out] long * plVCRHorizontalLocking);
  7314.  
  7315.             // Returns the number of lines in the video signal")]
  7316.             HRESULT get_NumberOfLines (
  7317.                         [out] long *plNumberOfLines);
  7318.  
  7319.             // Enables or disables the output bus
  7320.             HRESULT put_OutputEnable (
  7321.                         [in] long lOutputEnable);
  7322.  
  7323.             HRESULT get_OutputEnable (
  7324.                         [out] long *plOutputEnable);
  7325.  
  7326.         }
  7327.  
  7328.  
  7329.         //---------------------------------------------------------------------
  7330.         // VideoProcAmp Property enum
  7331.         //---------------------------------------------------------------------
  7332.  
  7333.         typedef enum tagVideoProcAmpProperty
  7334.         {
  7335.             VideoProcAmp_Brightness,
  7336.             VideoProcAmp_Contrast,
  7337.             VideoProcAmp_Hue,
  7338.             VideoProcAmp_Saturation,
  7339.             VideoProcAmp_Sharpness,
  7340.             VideoProcAmp_Gamma,
  7341.             VideoProcAmp_ColorEnable,
  7342.             VideoProcAmp_WhiteBalance,
  7343.             VideoProcAmp_BacklightCompensation,
  7344.             VideoProcAmp_Gain
  7345.         } VideoProcAmpProperty;
  7346.  
  7347.         //---------------------------------------------------------------------
  7348.         // VideoProcAmp Flags enum
  7349.         //---------------------------------------------------------------------
  7350.  
  7351.         typedef enum tagVideoProcAmpFlags
  7352.         {
  7353.             VideoProcAmp_Flags_Auto   = 0x0001,
  7354.             VideoProcAmp_Flags_Manual = 0x0002
  7355.         } VideoProcAmpFlags;
  7356.  
  7357.         //---------------------------------------------------------------------
  7358.         // IAMVideoProcAmp interface
  7359.         //
  7360.         // Adjusts video quality in either the analog or digital domain.
  7361.         //
  7362.         //---------------------------------------------------------------------
  7363.  
  7364.         [
  7365.         object,
  7366.             uuid(C6E13360-30AC-11d0-A18C-00A0C9118956),
  7367.         pointer_default(unique)
  7368.         ]
  7369.         interface IAMVideoProcAmp : IUnknown
  7370.         {
  7371.             // Returns min, max, step size, and default values
  7372.             HRESULT GetRange(
  7373.                 [in] long Property,         // Which property to query
  7374.                 [out] long * pMin,          // Range minimum
  7375.                 [out] long * pMax,          // Range maxumum
  7376.                 [out] long * pSteppingDelta,// Step size
  7377.                 [out] long * pDefault,      // Default value
  7378.                 [out] long * pCapsFlags     // VideoProcAmpFlags
  7379.  
  7380.             );
  7381.  
  7382.             // Set a VideoProcAmp property
  7383.             HRESULT Set(
  7384.                 [in]  long Property,        // VideoProcAmpProperty
  7385.                 [in]  long lValue,          // Value to set
  7386.                 [in]  long Flags            // VideoProcAmp_Flags_*
  7387.  
  7388.             );
  7389.  
  7390.             // Get a VideoProcAmp property
  7391.             HRESULT Get(
  7392.                 [in]  long Property,        // VideoProcAmpProperty
  7393.                 [out] long * lValue,        // Current value
  7394.                 [out] long * Flags          // VideoProcAmp_Flags_*
  7395.             );
  7396.         }
  7397.  
  7398.  
  7399.         //---------------------------------------------------------------------
  7400.         // CameraControl Property enum
  7401.         //---------------------------------------------------------------------
  7402.  
  7403.         typedef enum tagCameraControlProperty
  7404.         {
  7405.             CameraControl_Pan,
  7406.             CameraControl_Tilt,
  7407.             CameraControl_Roll,
  7408.             CameraControl_Zoom,
  7409.             CameraControl_Exposure,
  7410.             CameraControl_Iris,
  7411.             CameraControl_Focus
  7412.         } CameraControlProperty;
  7413.  
  7414.         //---------------------------------------------------------------------
  7415.         // CameraControl Flags enum
  7416.         //---------------------------------------------------------------------
  7417.  
  7418.         typedef enum tagCameraControlFlags
  7419.         {
  7420.             CameraControl_Flags_Auto     = 0x0001,
  7421.             CameraControl_Flags_Manual   = 0x0002
  7422.         } CameraControlFlags;
  7423.  
  7424.         //---------------------------------------------------------------------
  7425.         // IAMCameraControl interface
  7426.         //
  7427.         // Control of local or remote cameras
  7428.         //---------------------------------------------------------------------
  7429.  
  7430.         [
  7431.         object,
  7432.             uuid(C6E13370-30AC-11d0-A18C-00A0C9118956),
  7433.         pointer_default(unique)
  7434.         ]
  7435.         interface IAMCameraControl : IUnknown
  7436.         {
  7437.             // Returns min, max, step size, and default values
  7438.             HRESULT GetRange(
  7439.                 [in] long Property,         // Which property to query
  7440.                 [out] long * pMin,          // Range minimum
  7441.                 [out] long * pMax,          // Range maxumum
  7442.                 [out] long * pSteppingDelta,// Step size
  7443.                 [out] long * pDefault,      // Default value
  7444.                 [out] long * pCapsFlags     // CamaeraControlFlags
  7445.  
  7446.             );
  7447.  
  7448.             // Set a CameraControl property
  7449.             HRESULT Set(
  7450.                 [in]  long Property,        // CameraControlProperty
  7451.                 [in]  long lValue,          // Value to set
  7452.                 [in]  long Flags            // CameraControl_Flags_*
  7453.  
  7454.             );
  7455.  
  7456.             // Get a CameraControl property
  7457.             HRESULT Get(
  7458.                 [in]  long Property,        // CameraControlProperty
  7459.                 [out] long * lValue,        // Current value
  7460.                 [out] long * Flags          // CameraControl_Flags_*
  7461.             );
  7462.         }
  7463.  
  7464.         //---------------------------------------------------------------------
  7465.         // VideoControl Flags enum
  7466.         //---------------------------------------------------------------------
  7467.  
  7468.         typedef enum tagVideoControlFlags
  7469.         {
  7470.             VideoControlFlag_FlipHorizontal        = 0x0001,
  7471.             VideoControlFlag_FlipVertical          = 0x0002,
  7472.             VideoControlFlag_ExternalTriggerEnable = 0x0004,
  7473.             VideoControlFlag_Trigger               = 0x0008
  7474.  
  7475.         } VideoControlFlags;
  7476.  
  7477.         //---------------------------------------------------------------------
  7478.         // IAMVideoControl interface
  7479.         //
  7480.         // Control of horizontal & vertical flip, external trigger,
  7481.         // and listing available frame rates
  7482.         //---------------------------------------------------------------------
  7483.  
  7484.         [
  7485.         object,
  7486.             uuid(6a2e0670-28e4-11d0-a18c-00a0c9118956),
  7487.             pointer_default(unique)
  7488.         ]
  7489.         interface IAMVideoControl : IUnknown
  7490.         {
  7491.             // What can the underlying hardware do?
  7492.             HRESULT GetCaps(
  7493.                 [in]  IPin * pPin,          // the pin to query or control
  7494.                 [out] long * pCapsFlags     // VideoControlFlag_*
  7495.  
  7496.             );
  7497.  
  7498.             // Set the mode of operation
  7499.             HRESULT SetMode(
  7500.                 [in]  IPin * pPin,          // the pin to query or control
  7501.                 [in]  long Mode             // VideoControlFlag_*
  7502.  
  7503.             );
  7504.  
  7505.             // Get the mode of operation
  7506.             HRESULT GetMode(
  7507.                 [in]  IPin * pPin,          // the pin to query or control
  7508.                 [out] long * Mode           // VideoControlFlag_*
  7509.             );
  7510.  
  7511.             // Get actual frame rate info for USB and 1394
  7512.             // This is only available when streaming
  7513.             HRESULT GetCurrentActualFrameRate(
  7514.                 [in]  IPin * pPin,                  // the pin to query or control
  7515.                 [out] LONGLONG * ActualFrameRate    // 100 nS units
  7516.             );
  7517.  
  7518.             // Get max available frame rate info for USB and 1394
  7519.             // Returns the max frame rate currently available based on bus bandwidth usage
  7520.             HRESULT GetMaxAvailableFrameRate(
  7521.                 [in]  IPin * pPin,          // the pin to query or control
  7522.                 [in]  long iIndex,          // 0 to IAMStreamConfig->GetNumberOfCapabilities-1
  7523.                 [in]  SIZE Dimensions,      // width and height
  7524.                 [out] LONGLONG * MaxAvailableFrameRate  // 100 nS units
  7525.             );
  7526.  
  7527.             // Get List of available frame rates
  7528.             HRESULT GetFrameRateList(
  7529.                 [in]  IPin * pPin,           // the pin to query or control
  7530.                 [in]  long iIndex,           // 0 to IAMStreamConfig->GetNumberOfCapabilities-1
  7531.                 [in]  SIZE Dimensions,       // width and height
  7532.                 [out] long * ListSize,       // Number of elements in the list
  7533.                 [out] LONGLONG ** FrameRates // Array of framerates in 100 nS units
  7534.                                              // or NULL to just get ListSize
  7535.             );
  7536.  
  7537.         }
  7538.  
  7539.  
  7540.         //---------------------------------------------------------------------
  7541.         // IAMCrossbar interface
  7542.         //
  7543.         // Controls a routing matrix for analog or digital video or audio
  7544.         //---------------------------------------------------------------------
  7545.  
  7546.         [
  7547.         object,
  7548.             uuid(C6E13380-30AC-11d0-A18C-00A0C9118956),
  7549.         pointer_default(unique)
  7550.         ]
  7551.         interface IAMCrossbar : IUnknown
  7552.         {
  7553.  
  7554.             // How many pins are there?
  7555.             HRESULT get_PinCounts(
  7556.                     [out] long * OutputPinCount,        // count of output pins
  7557.                     [out] long * InputPinCount);        // count of input pins
  7558.  
  7559.             // True if routing is possible
  7560.             HRESULT CanRoute (
  7561.                     [in]  long OutputPinIndex,          // the output pin
  7562.                     [in]  long InputPinIndex);          // the input pin
  7563.  
  7564.             // Routes an input pin to an output pin
  7565.             HRESULT Route (
  7566.                     [in]  long OutputPinIndex,          // the output pin
  7567.                     [in]  long InputPinIndex);          // the input pin
  7568.  
  7569.             // Returns the input pin connected to a given output pin
  7570.             HRESULT get_IsRoutedTo (
  7571.                     [in]  long OutputPinIndex,          // the output pin
  7572.                     [out] long * InputPinIndex);        // the connected input pin
  7573.  
  7574.             // Returns a pin which is related to a given pin
  7575.             // (ie. this audio pin is related to a video pin)
  7576.             HRESULT get_CrossbarPinInfo (
  7577.                     [in] BOOL IsInputPin,               // TRUE for input pins
  7578.                     [in] long PinIndex,                 // a pin
  7579.                     [out] long * PinIndexRelated,       // Index of related pin
  7580.                     [out] long * PhysicalType);         // Physical type of pin
  7581.  
  7582.         }
  7583.  
  7584.  
  7585.         //---------------------------------------------------------------------
  7586.         // IAMTuner interface
  7587.         //
  7588.         // base tuner device
  7589.         //---------------------------------------------------------------------
  7590.         
  7591.         // predefined subchannel values
  7592.         typedef enum tagAMTunerSubChannel
  7593.         {
  7594.             AMTUNER_SUBCHAN_NO_TUNE     = -2,   // don't tune
  7595.             AMTUNER_SUBCHAN_DEFAULT     = -1    // use default sub chan
  7596.         } AMTunerSubChannel;
  7597.         
  7598.         // predefined signal strength values
  7599.         typedef enum tagAMTunerSignalStrength
  7600.         {
  7601.             AMTUNER_HASNOSIGNALSTRENGTH = -1,   // cannot indicate signal strength
  7602.             AMTUNER_NOSIGNAL            = 0,    // no signal available
  7603.             AMTUNER_SIGNALPRESENT       = 1     // signal present
  7604.         } AMTunerSignalStrength;
  7605.  
  7606.         // specifies the mode of operation of the tuner 
  7607.         typedef enum tagAMTunerModeType
  7608.         {
  7609.             AMTUNER_MODE_DEFAULT    = 0x0000,   // default tuner mode
  7610.             AMTUNER_MODE_TV         = 0x0001,   // tv
  7611.             AMTUNER_MODE_FM_RADIO   = 0x0002,   // fm radio
  7612.             AMTUNER_MODE_AM_RADIO   = 0x0004,   // am radio
  7613.             AMTUNER_MODE_DSS        = 0x0008,   // dss
  7614.         } AMTunerModeType;
  7615.         
  7616.         // Events reported by IAMTunerNotification
  7617.         typedef enum tagAMTunerEventType{
  7618.             AMTUNER_EVENT_CHANGED   = 0x0001,   // status changed
  7619.         } AMTunerEventType;
  7620.         
  7621.         interface IAMTunerNotification;
  7622.  
  7623.         [
  7624.             object,
  7625.             uuid(211A8761-03AC-11d1-8D13-00AA00BD8339),
  7626.             pointer_default(unique)
  7627.         ]
  7628.         interface IAMTuner : IUnknown
  7629.         {
  7630.             // Sets and gets the Channel
  7631.             HRESULT put_Channel(
  7632.                 [in] long lChannel,
  7633.                 [in] long lVideoSubChannel,
  7634.                 [in] long lAudioSubChannel
  7635.                 );
  7636.             HRESULT get_Channel(
  7637.                 [out] long *plChannel,
  7638.                 [out] long *plVideoSubChannel,
  7639.                 [out] long *plAudioSubChannel
  7640.                 );
  7641.         
  7642.             // Gets the minimum and maximum channel available
  7643.             HRESULT ChannelMinMax(
  7644.                 [out] long *lChannelMin,
  7645.                 [out] long *lChannelMax
  7646.                 );
  7647.         
  7648.             // CountryCode is the same as the international
  7649.             // long distance telephone dialing prefix
  7650.             
  7651.             HRESULT put_CountryCode(
  7652.                 [in] long lCountryCode
  7653.                 );
  7654.             HRESULT get_CountryCode(
  7655.                 [out] long *plCountryCode
  7656.                 );
  7657.         
  7658.             HRESULT put_TuningSpace(
  7659.                 [in] long lTuningSpace
  7660.                 );
  7661.             HRESULT get_TuningSpace(
  7662.                 [out] long *plTuningSpace
  7663.                 );
  7664.         
  7665.             [local] HRESULT Logon(
  7666.                 [in] HANDLE hCurrentUser
  7667.                 );
  7668.             HRESULT Logout();
  7669.         
  7670.             // Signal status for current channel
  7671.             // signal strength == TUNER_NOSIGNAL, or strength value
  7672.             HRESULT SignalPresent(
  7673.                 [out] long * plSignalStrength   // AMTunerSignalStrength
  7674.                 );
  7675.         
  7676.             // allow multifunction tuner to be switch between modes
  7677.             HRESULT put_Mode(
  7678.                 [in] AMTunerModeType lMode      // AMTunerModeType
  7679.                 );
  7680.             HRESULT get_Mode(
  7681.                 [out] AMTunerModeType *plMode   // AMTunerModeType
  7682.                 );
  7683.         
  7684.             // retrieve a bitmask of the possible modes
  7685.             HRESULT GetAvailableModes(
  7686.                 [out] long *plModes             // AMTunerModeType
  7687.                 );
  7688.         
  7689.             // allow IAMTuner clients to receive event notification
  7690.             HRESULT RegisterNotificationCallBack(
  7691.                 [in] IAMTunerNotification *pNotify,
  7692.                 [in] long lEvents       // bitmask from AMTunerEventType enumeration
  7693.                 );
  7694.             HRESULT UnRegisterNotificationCallBack(
  7695.                             [in] IAMTunerNotification *pNotify
  7696.                 );
  7697.         }
  7698.         
  7699.         //---------------------------------------------------------------------
  7700.         // IAMTunerNotification interface
  7701.         //
  7702.         // Provided to IAMTuner if notification callbacks are desired
  7703.         //---------------------------------------------------------------------
  7704.         
  7705.         [
  7706.             object,
  7707.             uuid(211A8760-03AC-11d1-8D13-00AA00BD8339),
  7708.             pointer_default(unique)
  7709.         ]
  7710.         interface IAMTunerNotification : IUnknown
  7711.         {
  7712.             HRESULT OnEvent([in] AMTunerEventType Event);
  7713.         }
  7714.         
  7715.         
  7716.         //---------------------------------------------------------------------
  7717.         // IAMTVTuner interface
  7718.         //
  7719.         // Controls an analog TV tuner device
  7720.         //---------------------------------------------------------------------
  7721.  
  7722.         [
  7723.             object,
  7724.             uuid(211A8766-03AC-11d1-8D13-00AA00BD8339),
  7725.             pointer_default(unique)
  7726.         ]
  7727.         interface IAMTVTuner : IAMTuner
  7728.         {
  7729.             // Gets the supported analog video standards (NTSC/M, PAL/B, SECAM/K1, ...
  7730.             HRESULT get_AvailableTVFormats(
  7731.                 [out] long *lAnalogVideoStandard
  7732.                 );
  7733.         
  7734.             // Gets the current analog video standard (NTSC/M, PAL/B, SECAM/K1, ...)
  7735.             HRESULT get_TVFormat(
  7736.                 [out] long * plAnalogVideoStandard
  7737.                 );
  7738.         
  7739.             // Scans for a signal on a given channel
  7740.             // NOTE: this is equivalent to put_Channel(), SignalStrength()
  7741.             HRESULT AutoTune(
  7742.                 [in] long lChannel,
  7743.                 [out] long * plFoundSignal
  7744.                 );
  7745.         
  7746.             // Saves the fine tuning information for all channels")]
  7747.             HRESULT StoreAutoTune();
  7748.         
  7749.             // The number of TV sources plugged into the tuner
  7750.             HRESULT get_NumInputConnections(
  7751.                 [out] long * plNumInputConnections
  7752.                 );
  7753.         
  7754.             // Sets or gets the tuner input type (Cable or Antenna)
  7755.             HRESULT put_InputType(
  7756.                 [in] long lIndex,
  7757.                 [in] TunerInputType InputType
  7758.                 );
  7759.             HRESULT get_InputType(
  7760.                 [in] long lIndex,
  7761.                 [out] TunerInputType * pInputType
  7762.                 );
  7763.         
  7764.             // Sets or gets the tuner input
  7765.             HRESULT put_ConnectInput(
  7766.                 [in] long lIndex
  7767.                 );
  7768.             HRESULT get_ConnectInput(
  7769.                 [out] long *plIndex
  7770.                 );
  7771.         
  7772.             // Gets the video and audio carrier frequencies
  7773.             HRESULT get_VideoFrequency(
  7774.                 [out] long *lFreq
  7775.                 );
  7776.             HRESULT get_AudioFrequency(
  7777.                 [out] long *lFreq
  7778.                 );
  7779.         }
  7780.  
  7781.         
  7782.         //---------------------------------------------------------------------
  7783.         // IBPCSatelliteTuner interface
  7784.         //
  7785.         // An interface supporting Satellite tuning-related functions
  7786.         //---------------------------------------------------------------------
  7787.         [
  7788.             object,
  7789.             local,
  7790.             uuid(211A8765-03AC-11d1-8D13-00AA00BD8339),
  7791.             pointer_default(unique)
  7792.         ]
  7793.         interface IBPCSatelliteTuner : IAMTuner
  7794.         {
  7795.             HRESULT get_DefaultSubChannelTypes(
  7796.                 [out] long *plDefaultVideoType, // Provider-specific service type
  7797.                 [out] long *plDefaultAudioType  // Provider-specific service type
  7798.                 );
  7799.         
  7800.             HRESULT put_DefaultSubChannelTypes(
  7801.                 [in] long lDefaultVideoType,    // Provider-specific service type
  7802.                 [in] long lDefaultAudioType     // Provider-specific service type
  7803.                 );
  7804.         
  7805.             HRESULT IsTapingPermitted();        // S_OK yes, S_FALSE no
  7806.         }
  7807.  
  7808.  
  7809.  
  7810.         //---------------------------------------------------------------------
  7811.         // IAMTVAudio interface
  7812.         //
  7813.         // TV Audio control
  7814.         //---------------------------------------------------------------------
  7815.         
  7816.         typedef enum tagTVAudioMode
  7817.         {
  7818.             AMTVAUDIO_MODE_MONO         = 0x0001,       // Mono                 
  7819.             AMTVAUDIO_MODE_STEREO       = 0x0002,       // Stereo
  7820.             AMTVAUDIO_MODE_LANG_A       = 0x0010,       // Primary language
  7821.             AMTVAUDIO_MODE_LANG_B       = 0x0020,       // 2nd avail language
  7822.             AMTVAUDIO_MODE_LANG_C       = 0x0040,       // 3rd avail language
  7823.         } TVAudioMode;
  7824.  
  7825.         // Events reported by IAMTVAudioNotification
  7826.         typedef enum tagAMTVAudioEventType
  7827.         {
  7828.             AMTVAUDIO_EVENT_CHANGED     = 0x0001,       // mode changed
  7829.         } AMTVAudioEventType;
  7830.  
  7831.         interface IAMTVAudioNotification;
  7832.  
  7833.         [
  7834.             object,
  7835.             local,
  7836.             uuid(83EC1C30-23D1-11d1-99E6-00A0C9560266),
  7837.             pointer_default(unique)
  7838.         ]
  7839.         interface IAMTVAudio : IUnknown
  7840.         {
  7841.             // retrieve a bitmask of the formats available in the hardware
  7842.             HRESULT GetHardwareSupportedTVAudioModes(
  7843.                 [out] long *plModes             // TVAudioMode
  7844.                 );
  7845.                 
  7846.             // retrieve a bitmask of the possible modes
  7847.             HRESULT GetAvailableTVAudioModes(
  7848.                 [out] long *plModes             // TVAudioMode
  7849.                 );
  7850.                 
  7851.             HRESULT get_TVAudioMode(
  7852.                 [out] long *plMode              // TVAudioMode
  7853.                 );
  7854.             HRESULT put_TVAudioMode(
  7855.                 [in] long lMode                 // TVAudioMode
  7856.                 );
  7857.  
  7858.             // allow IAMTVAudio clients to receive event notification
  7859.             HRESULT RegisterNotificationCallBack(
  7860.                 [in] IAMTunerNotification *pNotify,
  7861.                 [in] long lEvents       // bitmask from AMTVAudioEventType enumeration
  7862.                 );
  7863.             HRESULT UnRegisterNotificationCallBack(
  7864.                 IAMTunerNotification *pNotify
  7865.                 );
  7866.         }
  7867.  
  7868.         //---------------------------------------------------------------------
  7869.         // IAMTVAudioNotification interface
  7870.         //
  7871.         // Provided to IAMTVAudio clients if notification callbacks are desired
  7872.         //---------------------------------------------------------------------
  7873.         
  7874.         [
  7875.             object,
  7876.             local,
  7877.             uuid(83EC1C33-23D1-11d1-99E6-00A0C9560266),
  7878.             pointer_default(unique)
  7879.         ]
  7880.         interface IAMTVAudioNotification : IUnknown
  7881.         {
  7882.             HRESULT OnEvent([in] AMTVAudioEventType Event);
  7883.         }
  7884.  
  7885.  
  7886.  
  7887.  
  7888.         //---------------------------------------------------------------------
  7889.         // IAMAnalogVideoEncoder interface
  7890.         //---------------------------------------------------------------------
  7891.  
  7892.         [
  7893.        object,
  7894.             uuid(C6E133B0-30AC-11d0-A18C-00A0C9118956),
  7895.         pointer_default(unique)
  7896.         ]
  7897.         interface IAMAnalogVideoEncoder : IUnknown
  7898.         {
  7899.             // Gets the supported analog video standards (NTSC/M, PAL/B, SECAM/K1, ...)
  7900.             HRESULT get_AvailableTVFormats(
  7901.                         [out] long *lAnalogVideoStandard
  7902.                         );
  7903.  
  7904.             // Sets or gets the current analog video standard (NTSC/M, PAL/B, SECAM/K1, ...)
  7905.             HRESULT put_TVFormat(
  7906.                         [in] long lAnalogVideoStandard
  7907.                         );
  7908.  
  7909.             HRESULT get_TVFormat(
  7910.                         [out] long * plAnalogVideoStandard
  7911.                         );
  7912.  
  7913.             // Sets or gets the copy protection
  7914.             HRESULT put_CopyProtection (
  7915.                         [in]  long lVideoCopyProtection); // VideoCopyProtectionType
  7916.  
  7917.             HRESULT get_CopyProtection (
  7918.                         [out] long *lVideoCopyProtection); // VideoCopyProtectionType
  7919.  
  7920.  
  7921.             // Enables and disables close captioning
  7922.             HRESULT put_CCEnable (
  7923.                         [in] long lCCEnable);
  7924.  
  7925.             HRESULT get_CCEnable (
  7926.                         [out] long *lCCEnable);
  7927.  
  7928.         }
  7929.  
  7930.         // used by IKsPropertySet set AMPROPSETID_Pin
  7931.         typedef enum {
  7932.         AMPROPERTY_PIN_CATEGORY,
  7933.             AMPROPERTY_PIN_MEDIUM
  7934.         } AMPROPERTY_PIN;
  7935.  
  7936.         //---------------------------------------------------------------------
  7937.         // IKsPropertySet interface
  7938.         //
  7939.         // Sets or gets a property identified by a property set GUID and a
  7940.         // property ID.
  7941.         //
  7942.         // Return codes for all 3 methods:
  7943.         //    E_PROP_SET_UNSUPPORTED  the property set is not supported
  7944.         //    E_PROP_ID_UNSUPPORTED   the property ID is not supported
  7945.         //                                for the specified property set
  7946.         //---------------------------------------------------------------------
  7947.  
  7948.     cpp_quote("#ifndef _IKsPropertySet_")
  7949.     cpp_quote("#define _IKsPropertySet_")
  7950.  
  7951.         //---------------------------------------------------------------------
  7952.         // #defines for IKsPropertySet::QuerySupported return result in pTypeSupport
  7953.         //---------------------------------------------------------------------
  7954.  
  7955.     cpp_quote("#define KSPROPERTY_SUPPORT_GET  1")
  7956.     cpp_quote("#define KSPROPERTY_SUPPORT_SET  2")
  7957.  
  7958.  
  7959.         [
  7960.         object,
  7961.         uuid(31EFAC30-515C-11d0-A9AA-00AA0061BE93),
  7962.         pointer_default(unique)
  7963.         ]
  7964.         interface IKsPropertySet : IUnknown
  7965.         {
  7966.             [local] HRESULT Set(
  7967.                         [in]    REFGUID     guidPropSet,
  7968.                         [in]    DWORD       dwPropID,
  7969.                         [in, size_is(cbInstanceData)] LPVOID pInstanceData,
  7970.                         [in]    DWORD       cbInstanceData,
  7971.                         [in, size_is(cbPropData)] LPVOID pPropData,
  7972.                         [in]    DWORD       cbPropData);
  7973.  
  7974.             [call_as(Set)] HRESULT RemoteSet(
  7975.                         [in]    REFGUID     guidPropSet,
  7976.                         [in]    DWORD       dwPropID,
  7977.                         [in, size_is(cbInstanceData)] byte * pInstanceData,
  7978.                         [in]    DWORD       cbInstanceData,
  7979.                         [in, size_is(cbPropData)] byte * pPropData,
  7980.                         [in]    DWORD       cbPropData);
  7981.  
  7982.             // To get a property, the caller allocates a buffer which the called
  7983.             // function fills in.  To determine necessary buffer size, call Get with
  7984.             // pPropData=NULL and cbPropData=0.
  7985.             [local] HRESULT Get(
  7986.                         [in]    REFGUID     guidPropSet,
  7987.                         [in]    DWORD       dwPropID,
  7988.                         [in, size_is(cbInstanceData)] LPVOID pInstanceData,
  7989.                         [in]    DWORD       cbInstanceData,
  7990.                         [out, size_is(cbPropData)] LPVOID pPropData,
  7991.                         [in]    DWORD       cbPropData,
  7992.                         [out]   DWORD *     pcbReturned);
  7993.  
  7994.             [call_as(Get)] HRESULT RemoteGet(
  7995.                         [in]    REFGUID     guidPropSet,
  7996.                         [in]    DWORD       dwPropID,
  7997.                         [in, size_is(cbInstanceData)] byte * pInstanceData,
  7998.                         [in]    DWORD       cbInstanceData,
  7999.                         [out, size_is(cbPropData)] byte * pPropData,
  8000.                         [in]    DWORD       cbPropData,
  8001.                         [out]   DWORD *     pcbReturned);
  8002.  
  8003.             // QuerySupported must either return E_NOTIMPL or correctly indicate
  8004.             // if getting or setting the property set and property is supported.
  8005.             // S_OK indicates the property set and property ID combination is
  8006.             HRESULT QuerySupported(
  8007.                         [in]    REFGUID     guidPropSet,
  8008.                         [in]    DWORD       dwPropID,
  8009.                         [out]   DWORD       *pTypeSupport);
  8010.         }
  8011.     cpp_quote("#endif // _IKsPropertySet_")
  8012.  
  8013.     [
  8014.     object,
  8015.     uuid(6025A880-C0D5-11d0-BD4E-00A0C911CE86),
  8016.     pointer_default(unique)
  8017.     ]
  8018.     interface IMediaPropertyBag : IPropertyBag
  8019.     {
  8020.         import "ocidl.idl";
  8021.  
  8022.         typedef IMediaPropertyBag *LPMEDIAPROPERTYBAG;
  8023.  
  8024.         // return the i'th element in the property bag
  8025.         HRESULT EnumProperty(
  8026.             [in]  ULONG iProperty,
  8027.             [in, out] VARIANT * pvarPropertyName,
  8028.             [in, out] VARIANT * pvarPropertyValue
  8029.             );
  8030.  
  8031.     }
  8032.  
  8033.  
  8034.     [
  8035.     object,
  8036.     uuid(5738E040-B67F-11d0-BD4D-00A0C911CE86),
  8037.     pointer_default(unique)
  8038.     ]
  8039.     interface IPersistMediaPropertyBag : IPersist
  8040.     {
  8041.         import "ocidl.idl";
  8042.         import "unknwn.idl";
  8043.  
  8044.         HRESULT InitNew(
  8045.             void
  8046.             );
  8047.  
  8048.         HRESULT Load(
  8049.             [in] IMediaPropertyBag * pPropBag,
  8050.             [in] IErrorLog * pErrorLog
  8051.             );
  8052.  
  8053.         HRESULT Save(
  8054.             [in] IMediaPropertyBag * pPropBag,
  8055.             [in] BOOL fClearDirty,
  8056.             [in] BOOL fSaveAllProperties
  8057.             );
  8058.  
  8059.  
  8060.         typedef IPersistMediaPropertyBag * LPPERSISTMEDIAPROPERTYBAG;
  8061.     }
  8062.  
  8063.  
  8064.        //---------------------------------------------------------------------
  8065.        //
  8066.        // Defines IAMPhysicalPinInfo Interface
  8067.        //
  8068.        // Returns an enum and string that describes an input pin's physical type.
  8069.        //
  8070.        // Implement if: you have physical input pins such as video or audio (like
  8071.        // on a video capture card or a VCR)
  8072.        //
  8073.        // Use if: you want to communicate to a user available physical input pins
  8074.        // and allow them to select the active one if there is more than one
  8075.        //---------------------------------------------------------------------
  8076.  
  8077.  
  8078.     [
  8079.         object,
  8080.          uuid(F938C991-3029-11cf-8C44-00AA006B6814),
  8081.          pointer_default(unique)
  8082.      ]
  8083.     interface IAMPhysicalPinInfo : IUnknown {
  8084.  
  8085.         // Returns VFW_E_NO_ACCEPTABLE_TYPES if not a physical pin
  8086.         HRESULT GetPhysicalType(
  8087.             [out] long *pType,          // the enum representing the Physical Type
  8088.             [out] LPOLESTR *ppszType        // a friendly name
  8089.         );
  8090.     }
  8091.     typedef IAMPhysicalPinInfo *PAMPHYSICALPININFO;
  8092.  
  8093.        //---------------------------------------------------------------------
  8094.        // Defines IAMExtDevice Interface
  8095.        //
  8096.        // Base interface for external professional devices
  8097.        //
  8098.        // Implement if: the filter controls an external device such as a VCR,
  8099.        // timecode reader/generator, etc.  The intent is to build a object from
  8100.        // this implementation plus another that specifically describes the device,
  8101.        // such as IAMExtTransport.
  8102.        //
  8103.        // Use if: you want to control and external device such as a VCR
  8104.        //
  8105.        // See edevdefs.h for the enumerated parameter list
  8106.        //---------------------------------------------------------------------
  8107.      [
  8108.         object,
  8109.          uuid(B5730A90-1A2C-11cf-8C23-00AA006B6814),
  8110.         pointer_default(unique)
  8111.      ]
  8112.      interface IAMExtDevice : IUnknown
  8113.      {
  8114.         // General device capabilities property.  See edevdefs.h for supported
  8115.         // values
  8116.         HRESULT GetCapability(
  8117.             [in] long Capability,       // identify the property
  8118.             [out] long *pValue,         // return value
  8119.             [out] double *pdblValue     // return value
  8120.         );
  8121.  
  8122.         // Get external device identification string.  Usually the model #
  8123.         // of the device
  8124.         HRESULT get_ExternalDeviceID(
  8125.             [out] LPOLESTR *ppszData        // ID string
  8126.         );
  8127.         
  8128.         HRESULT get_ExternalDeviceVersion(
  8129.             [out] LPOLESTR *ppszData        // revision string
  8130.         );
  8131.         
  8132.         // Controls the external device's power mode
  8133.         HRESULT put_DevicePower([in] long PowerMode
  8134.         );
  8135.         HRESULT get_DevicePower([out] long *pPowerMode
  8136.         );
  8137.         
  8138.         // Some devices need to be reset in some way, i.e., rewinding a VCR
  8139.         // to the beginning of the tape and resetting the counter to zero.
  8140.         HRESULT Calibrate(
  8141.             [in] HEVENT hEvent,
  8142.             [in] long Mode,
  8143.             [out] long *pStatus     // OATRUE is active, OAFALSE is inactive
  8144.         );
  8145.  
  8146.         // Selects the device's communications port, i.e.,COM1, IEEE1394, etc.
  8147.         // See edevdefs.h for enums
  8148.         HRESULT put_DevicePort([in] long DevicePort
  8149.         );
  8150.         HRESULT get_DevicePort([out] long *pDevicePort
  8151.         );
  8152.         
  8153.     }
  8154.     typedef IAMExtDevice *PEXTDEVICE;
  8155.  
  8156.        //---------------------------------------------------------------------
  8157.        // Defines IAMExtTransport Interface
  8158.        //
  8159.        // Contains properties and methods that control behavior of an external
  8160.        // transport device such as a VTR
  8161.        //
  8162.        // Implement if: you control such a device.  Intended to be agregated
  8163.        // with IAMExtDevice.
  8164.        //
  8165.        // Use if: you want to control such a device
  8166.        //
  8167.        // See edevdefs.h for the parameter lists
  8168.        //---------------------------------------------------------------------
  8169.     [
  8170.         object,
  8171.          uuid(A03CD5F0-3045-11cf-8C44-00AA006B6814),
  8172.          pointer_default(unique)
  8173.      ]
  8174.     interface IAMExtTransport : IUnknown {
  8175.  
  8176.         // General transport capabilities property.  See edevdefs.h for enums
  8177.         HRESULT GetCapability(
  8178.             [in] long Capability,       // identify the property
  8179.             [out] long *pValue,         // return value
  8180.             [out] double *pdblValue     // return value
  8181.         );
  8182.  
  8183.         // For disc-based devices: spinning, or not spinning.
  8184.         // For tape-based device: threaded, unthreaded or ejected
  8185.         HRESULT put_MediaState([in] long State
  8186.         );
  8187.         HRESULT get_MediaState([out] long *pState   // see edevdefs.h
  8188.         );
  8189.             
  8190.         // Determines state of unit's front panel
  8191.         HRESULT put_LocalControl([in] long State
  8192.         );
  8193.         HRESULT get_LocalControl([out] long *pState // OATRUE or OAFALSE
  8194.         );
  8195.         
  8196.         // Transport status such as Play, Stop, etc.  More extensive
  8197.         // than AM states.
  8198.         HRESULT GetStatus(
  8199.             [in] long StatusItem,   // see edevdefs.h
  8200.             [out] long *pValue
  8201.         );
  8202.  
  8203.         // Parameters such as recording speed, servo reference, ballistics, etc.
  8204.         HRESULT GetTransportBasicParameters(
  8205.             [in] long Param,
  8206.             [out] long *pValue,
  8207.             [out] LPOLESTR *ppszData
  8208.         );
  8209.  
  8210.         HRESULT SetTransportBasicParameters(
  8211.             [in] long Param,
  8212.             [in] long Value,
  8213.             [in] LPCOLESTR pszData
  8214.         );
  8215.         
  8216.         // Parameters such as video output mode
  8217.         HRESULT GetTransportVideoParameters(
  8218.             [in] long Param,
  8219.             [out] long *pValue
  8220.         );
  8221.  
  8222.         HRESULT SetTransportVideoParameters(
  8223.             [in] long Param,
  8224.             [in] long Value
  8225.         );
  8226.  
  8227.         // Parameters such as audio channel enable
  8228.         HRESULT GetTransportAudioParameters(
  8229.             [in] long Param,
  8230.             [out] long *pValue
  8231.         );
  8232.  
  8233.         HRESULT SetTransportAudioParameters(
  8234.             [in] long Param,
  8235.             [in] long Value
  8236.         );
  8237.         
  8238.         // Mode is  the movement of the transport, i.e., Play, Stop,
  8239.         // Record, Edit, etc.
  8240.         HRESULT put_Mode([in] long Mode
  8241.         );
  8242.         HRESULT get_Mode([out] long *pMode
  8243.         );
  8244.  
  8245.         // Rate is for variable speed control of the the device.  This
  8246.         // can be linked to IMediaControl::Rate() in the implementation
  8247.         // if desired.
  8248.         HRESULT put_Rate([in] double dblRate
  8249.         );
  8250.         HRESULT get_Rate([out] double *pdblRate
  8251.         );
  8252.  
  8253.         // This is a lengthy method, that is, it is in effect until canceled or complete and
  8254.         // requires housekeeping by the filter.  It puts transport in play mode and maintains
  8255.         // fixed relationship between master time reference and transport position.
  8256.         HRESULT GetChase(
  8257.             [out] long *pEnabled,   // OATRUE | OAFALSE
  8258.             [out] long *pOffset,    // offset in current time format
  8259.             [out] HEVENT *phEvent   // completion notification
  8260.         );
  8261.         HRESULT SetChase(
  8262.             [in] long Enable,       // OATRUE | OAFALSE
  8263.             [in] long Offset,       // offset in current time format
  8264.             [in] HEVENT hEvent      // completion notification
  8265.         );
  8266.  
  8267.         // Also a lengthy method: temporarily change transport speed (for synchronizing).
  8268.         HRESULT GetBump(
  8269.             [out] long *pSpeed,
  8270.             [out] long *pDuration   // in current time format
  8271.         );
  8272.         HRESULT SetBump(
  8273.             [in] long Speed,
  8274.             [in] long Duration  // in current time format
  8275.         );
  8276.         
  8277.         // Enable/Disable transport anti-headclog control.
  8278.         HRESULT get_AntiClogControl([out] long *pEnabled    // OATRUE | OAFALSE
  8279.         );
  8280.         HRESULT put_AntiClogControl([in] long Enable    // OATRUE | OAFALSE
  8281.         );
  8282.         
  8283.         // The following group of properties describes edit events.  An edit event can be a
  8284.         // standard insert or assemble edit or a memorized position called a bookmark.
  8285.         // A NOTE ABOUT EVENTS: as with all lengthy commands, event objects must be created to
  8286.         // signal completion or error.
  8287.  
  8288.         // Intended usage: an edit event is prepared for use by:
  8289.         // 1. Registering an edit property set and getting an EditID
  8290.         // 2. Setting the necessary edit properties
  8291.         // 3. Setting the edit property set active
  8292.  
  8293.         // Please see edevdefs.h for properties and values
  8294.  
  8295.         // The reference clock's advance is the mechanism that puts an edit in motion (see
  8296.         // ED_EDIT_REC_INPOINT).
  8297.         
  8298.         // Property set methods
  8299.         HRESULT GetEditPropertySet(
  8300.             [in] long EditID,
  8301.             [out] long *pState  // ED_SET_ACTIVE | ED_SET_INACTIVE | ED_SET_INVALID
  8302.                                 // | ED_SET_EXECUTING
  8303.         );
  8304.  
  8305.         HRESULT SetEditPropertySet(
  8306.             [in, out] long *pEditID,
  8307.             [in] long State     // ED_SET_REGISTER | ED_SET_DELETE | ED_SET_ACTIVE |
  8308.         );                      // ED_SET_INACTIVE
  8309.  
  8310.         // the following properties define an edit event such as a bookmark, seek point, or
  8311.         //  actual edit
  8312.         HRESULT GetEditProperty(
  8313.             [in] long EditID,
  8314.             [in] long Param,
  8315.             [out] long *pValue
  8316.         );
  8317.         HRESULT SetEditProperty(
  8318.             [in] long EditID,
  8319.             [in] long Param,
  8320.             [in] long Value
  8321.         );
  8322.         
  8323.         // Activates a capable transport's edit control (typically used for "on the fly" editing).
  8324.         HRESULT get_EditStart([out] long *pValue    // OATRUE or OAFALSE
  8325.         );
  8326.         HRESULT put_EditStart([in] long Value           // OATRUE or OAFALSE
  8327.         );
  8328.     }
  8329.     typedef IAMExtTransport *PIAMEXTTRANSPORT;
  8330.  
  8331.        //---------------------------------------------------------------------
  8332.        // Defines IAMTimecodeReader Interface
  8333.        //
  8334.        // Contains properties and methods that define behavior of a
  8335.        // SMPTE/MIDI Timecode Reader.  It is expected that this interface
  8336.        // will be combined (aggregated) with IAMExtTransport to "build" a pro
  8337.        // VCR.
  8338.        //
  8339.        // Implement if: you control such a device
  8340.        //
  8341.        // Use if: you want to control such a device
  8342.        //
  8343.        // See edevdefs.h for the parameter lists
  8344.        //=====================================================================
  8345.  
  8346.  
  8347.     // timecode structures
  8348.     cpp_quote("#if 0")
  8349.     cpp_quote("/* the following is what MIDL knows how to remote */")
  8350.     typedef struct tagTIMECODE {
  8351.             WORD    wFrameRate; // will be replaced by AM defs, but see ED_FORMAT_SMPTE for now
  8352.             WORD    wFrameFract;    // fractional frame.  full scale is always 0x1000
  8353.             DWORD   dwFrames;
  8354.     }TIMECODE;
  8355.     cpp_quote("#else /* 0 */")
  8356.     cpp_quote("#ifndef TIMECODE_DEFINED")
  8357.     cpp_quote("#define TIMECODE_DEFINED")
  8358.     cpp_quote("typedef union _timecode {")
  8359.     cpp_quote("   struct {")
  8360.     cpp_quote("  WORD   wFrameRate;")
  8361.     cpp_quote("  WORD   wFrameFract;")
  8362.     cpp_quote("  DWORD  dwFrames;")
  8363.     cpp_quote("  };")
  8364.     cpp_quote("   DWORDLONG  qw;")
  8365.     cpp_quote("   } TIMECODE;")
  8366.     cpp_quote("")
  8367.     cpp_quote("#endif /* TIMECODE_DEFINED */")
  8368.     cpp_quote("#endif /* 0 */")
  8369.  
  8370.     typedef TIMECODE *PTIMECODE;
  8371.  
  8372.     typedef struct tagTIMECODE_SAMPLE {
  8373.         LONGLONG    qwTick;     // ActiveMovie 100ns timestamp
  8374.         TIMECODE    timecode;   // timecode
  8375.         DWORD       dwUser;     // timecode user data (aka user bits)
  8376.         DWORD       dwFlags;       // timecode flags - see below
  8377.     } TIMECODE_SAMPLE;
  8378.     typedef TIMECODE_SAMPLE *PTIMECODE_SAMPLE;
  8379.  
  8380.  
  8381.     [
  8382.         object,
  8383.         uuid(9B496CE1-811B-11cf-8C77-00AA006B6814),
  8384.         pointer_default(unique)
  8385.     ]
  8386.     interface IAMTimecodeReader : IUnknown
  8387.     {
  8388.         // Timecode Reader Mode - gets/sets the following properties
  8389.         // ED_TCR_SOURCE - timecode gen (readback), LTC, VITC, or Control Track
  8390.         HRESULT GetTCRMode(
  8391.             [in] long Param,
  8392.             [out] long *pValue);
  8393.         HRESULT SetTCRMode(
  8394.             [in] long Param,
  8395.             [in] long Value);
  8396.         
  8397.         // Select which line of the vertical interval timecode will be read from (if VITC).
  8398.         // To read VITC on specific multiple lines, the caller would make successive calls to
  8399.         // put_VITCLine(), once for each line desired.
  8400.         HRESULT put_VITCLine(
  8401.             [in] long Line );   // valid lines are 11-20, 0 means autoselect,
  8402.                                 // hi bit set means add to list of lines (for
  8403.                                 // readers that test across multiple lines)
  8404.         HRESULT get_VITCLine(
  8405.             [out] long *pLine ); // hi bit set means multiple lines are used,
  8406.                                 // and successive calls will cycle through the
  8407.                                 // line numbers (like an enumerator, only simpler)
  8408.  
  8409.         // GetTimecode can be used to obtain the most recent timecode value available in the
  8410.         // stream. The client can use this to monitor the timecode, parse duplicates and
  8411.         // discontinuities. The source filter supplying the timecode or possibly a down stream
  8412.         // filter might want to parse for discontinuities or errors since you have to look at
  8413.         // every sample to do this properly.
  8414.         //
  8415.  
  8416.         HRESULT GetTimecode(
  8417.           [out] PTIMECODE_SAMPLE pTimecodeSample) ;
  8418.  
  8419.     }
  8420.     typedef IAMTimecodeReader *PIAMTIMECODEREADER;
  8421.  
  8422.        //---------------------------------------------------------------------
  8423.        //=====================================================================
  8424.        // Defines IAMTimecodeGenerator Interface
  8425.        //
  8426.        // Contains properties and methods that define behavior of an external
  8427.        // SMPTE/MIDI Timecode Generator.  It is expected that this interface
  8428.        // will be combined (aggregated) with IAMExtTransport to "build" a pro
  8429.        // VCR.
  8430.        //
  8431.        // Implement if: you control such a device
  8432.        //
  8433.        // Use if: you want to control such a device
  8434.        //
  8435.        // See edevdefs.h for the parameter lists
  8436.         //---------------------------------------------------------------------
  8437.     [
  8438.         object,
  8439.         uuid(9B496CE0-811B-11cf-8C77-00AA006B6814),
  8440.         pointer_default(unique)
  8441.      ]
  8442.     interface IAMTimecodeGenerator : IUnknown {
  8443.  
  8444.         // Timecode Generator Mode - gets/sets the following properties (see
  8445.         // vcrdefss.h for detailed values):
  8446.         // ED_TCG_TIMECODE_TYPE - LTC, VITC, or MIDI
  8447.         // ED_TCG_FRAMERATE - 24, 25, 30 drop or 30 nondrop
  8448.         // ED_TCG_SYNC_SOURCE - what is driving the bitclock
  8449.         // ED_TCG_REFERENCE_SOURCE - what is driving the count value
  8450.         HRESULT GetTCGMode(
  8451.             [in] long Param,
  8452.             [out] long *pValue);
  8453.  
  8454.         HRESULT SetTCGMode(
  8455.             [in] long Param,
  8456.             [in] long Value);
  8457.  
  8458.         // Select into which line(s) of the vertical interval timecode will be inserted (if VITC).
  8459.         // Hi bit set means add this line to any previously set lines.
  8460.         // To generate VITC on specific multiple lines, the caller would make successive calls to
  8461.         // put_VITCLine(), once for each line desired.
  8462.         HRESULT put_VITCLine(
  8463.             [in] long Line      // valid lines are 11-20, 0 means autoselect(this setting
  8464.         );                      // is for TC readers that decode from multiple lines)
  8465.         HRESULT get_VITCLine(
  8466.             [out] long *pLine
  8467.         );
  8468.  
  8469.         // Sets timecode and/or userbit value.  If generator is running, takes effect
  8470.         // immediately.  If caller wants to set only timecode, set userbit value to -1L (and
  8471.         // same for setting userbits only)
  8472.         //
  8473.  
  8474.         HRESULT SetTimecode(
  8475.           [in] PTIMECODE_SAMPLE pTimecodeSample) ;
  8476.  
  8477.  
  8478.         // GetTimecode can be used to obtain the most recent timecode value available in the
  8479.         // stream. The client can use this to monitor the timecode and verify the generator is
  8480.         // working properly
  8481.         //
  8482.  
  8483.         HRESULT GetTimecode(
  8484.           [out] PTIMECODE_SAMPLE pTimecodeSample) ;
  8485.  
  8486.     }
  8487.     typedef IAMTimecodeGenerator *PIAMTIMECODEGENERATOR;
  8488.  
  8489.         //---------------------------------------------------------------------
  8490.        // Defines IAMTimecodeDisplay Interface
  8491.        //
  8492.        // Contains properties and methods that define behavior of an external
  8493.        // SMPTE/MIDI Timecode Display device (aka "character generator" for
  8494.        // making "burn-ins" or "window dubs"). It is expected that this interface
  8495.        // will be combined (aggregated) with IAMExtTransport and the timecode
  8496.        // interfaces to "build" a pro VCR.
  8497.        //
  8498.        // Implement if: you control such a device
  8499.        //
  8500.        // Use if: you want to control such a device
  8501.        //
  8502.        // See edevdefs.h for the parameter lists
  8503.         //---------------------------------------------------------------------
  8504.     [
  8505.          object,
  8506.          uuid(9B496CE2-811B-11cf-8C77-00AA006B6814),
  8507.          pointer_default(unique)
  8508.      ]
  8509.     interface IAMTimecodeDisplay : IUnknown
  8510.     {
  8511.         // Enable/disable external device's timecode reader's character generator output.  Some
  8512.         // readers have this feature - this is not intended for rendering inside the PC!
  8513.         HRESULT GetTCDisplayEnable(
  8514.             [out] long *pState);    // OATRUE | OAFALSE
  8515.         HRESULT SetTCDisplayEnable(
  8516.             [in] long State);       // OATRUE | OAFALSE
  8517.                                     // Timecode reader's character generator output
  8518.                                     //  characteristics (size, position, intensity, etc.).
  8519.         HRESULT GetTCDisplay(
  8520.             [in] long Param,
  8521.             [out] long *pValue);
  8522.         HRESULT SetTCDisplay(
  8523.             [in] long Param,
  8524.             [in] long Value);
  8525.  
  8526.         /* Allowable params and values (see edevdefs.h for details):
  8527.             ED_TCD_SOURCE
  8528.                 ED_TCR | ED_TCG
  8529.             ED_TCD_SIZE
  8530.                 ED_SMALL | ED_MED | ED_LARGE
  8531.             ED_TCD_POSITION
  8532.                 ED_TOP | ED_MIDDLE | ED_BOTTOM or'd  with
  8533.                 ED_LEFT | ED_CENTER | ED_RIGHT
  8534.             ED_TCD_INTENSITY
  8535.                 ED_HIGH | ED_LOW
  8536.             ED_TCD_TRANSPARENCY // set from 0 to 4, 0 being completely opaque
  8537.             ED_TCD_INVERT       // white on black or black on white
  8538.                 OATRUE | OAFALSE
  8539.             ED_TCD_BORDER       // white border for black chars, black border for white letters
  8540.                 OATRUE | OAFALSE
  8541.         */
  8542.     }
  8543.     typedef IAMTimecodeDisplay *PIAMTIMECODEDISPLAY;
  8544.  
  8545.  
  8546.     [
  8547.         object,
  8548.         uuid(c6545bf0-e76b-11d0-bd52-00a0c911ce86),
  8549.         pointer_default(unique)
  8550.     ]
  8551.     interface IAMDevMemoryAllocator : IUnknown
  8552.     {
  8553.         HRESULT GetInfo(
  8554.             [out] DWORD *pdwcbTotalFree,
  8555.             [out] DWORD *pdwcbLargestFree,
  8556.             [out] DWORD *pdwcbTotalMemory,
  8557.             [out] DWORD *pdwcbMinimumChunk);
  8558.  
  8559.         HRESULT CheckMemory(
  8560.             [in] const BYTE *pBuffer);
  8561.  
  8562.         HRESULT Alloc(
  8563.             [out] BYTE **ppBuffer,
  8564.             [in, out] DWORD *pdwcbBuffer);
  8565.  
  8566.         HRESULT Free(
  8567.             [in] BYTE *pBuffer);
  8568.  
  8569.         HRESULT GetDevMemoryObject(
  8570.             [out] IUnknown **ppUnkInnner,
  8571.             [in] IUnknown *pUnkOuter);
  8572.     }
  8573.     typedef IAMDevMemoryAllocator *PAMDEVMEMORYALLOCATOR;
  8574.  
  8575.  
  8576.     [
  8577.         object,
  8578.         uuid(c6545bf1-e76b-11d0-bd52-00a0c911ce86),
  8579.         pointer_default(unique)
  8580.     ]
  8581.     interface IAMDevMemoryControl : IUnknown
  8582.     {
  8583.         HRESULT QueryWriteSync();
  8584.  
  8585.         HRESULT WriteSync();
  8586.  
  8587.         HRESULT GetDevId(
  8588.             [out] DWORD *pdwDevId);
  8589.  
  8590.     }
  8591.     typedef IAMDevMemoryControl *PAMDEVMEMORYCONTROL;
  8592.  
  8593.     //  Flags for IAMStreamSelection::Info
  8594.     enum _AMSTREAMSELECTINFOFLAGS {
  8595.         AMSTREAMSELECTINFO_ENABLED   = 0x01,  // Enable - off for disable
  8596.         AMSTREAMSELECTINFO_EXCLUSIVE = 0x02   // Turns off the others in the group
  8597.                                               // when enabling this one
  8598.     };
  8599.     //  Flags for IAMStreamSelection::Enable
  8600.     enum _AMSTREAMSELECTENABLEFLAGS {
  8601.         //  Currently valid values are :
  8602.         //  0 - disable all streams in the group containing this stream
  8603.         //  ..._ENABLE - enable only this stream with in the given group
  8604.         //               and disable all others
  8605.         //  ..._ENABLEALL - send out all streams
  8606.         AMSTREAMSELECTENABLE_ENABLE    = 0x01,  // Enable
  8607.         AMSTREAMSELECTENABLE_ENABLEALL = 0x02   // Enable all streams in the group
  8608.                                                 // containing this stream
  8609.     };
  8610.  
  8611.     //  Control which logical streams are played and find out information about
  8612.     //  them
  8613.     //  Normally supported by a filter
  8614.     [
  8615.         object,
  8616.         uuid(c1960960-17f5-11d1-abe1-00a0c905f375),
  8617.         pointer_default(unique)
  8618.     ]
  8619.     interface IAMStreamSelect : IUnknown
  8620.     {
  8621.         //  Returns total count of streams
  8622.         HRESULT Count(
  8623.             [out] DWORD *pcStreams);      // Count of logical streams
  8624.  
  8625.         //  Return info for a given stream - S_FALSE if iIndex out of range
  8626.         //  The first steam in each group is the default
  8627.         HRESULT Info(
  8628.             [in] long lIndex,              // 0-based index
  8629.             [out] AM_MEDIA_TYPE **ppmt,   // Media type - optional
  8630.                                           // Use DeleteMediaType to free
  8631.             [out] DWORD *pdwFlags,        // flags - optional
  8632.             [out] LCID  *plcid,           // LCID (returns 0 if none) - optional
  8633.             [out] DWORD *pdwGroup,        // Logical group - optional
  8634.             [out] WCHAR **ppszName,       // Name - optional - free with CoTaskMemFree
  8635.                                           // optional
  8636.             [out] IUnknown **ppObject,    // Associated object - optional
  8637.                                           // Object may change if Enable is
  8638.                                           // called on this interface
  8639.                                           // - returns NULL if no associated object
  8640.                                           // Returns pin or filter for DShow
  8641.             [out] IUnknown **ppUnk);      // Stream specific interface
  8642.  
  8643.         //  Enable or disable a given stream
  8644.         HRESULT Enable(
  8645.             [in]  long lIndex,
  8646.             [in]  DWORD dwFlags);
  8647.     }
  8648.     typedef IAMStreamSelect *PAMSTREAMSELECT;
  8649.  
  8650.     enum _AMRESCTL_RESERVEFLAGS
  8651.     {
  8652.         AMRESCTL_RESERVEFLAGS_RESERVE     = 0x00,  // Increment reserve count
  8653.         AMRESCTL_RESERVEFLAGS_UNRESERVE   = 0x01   // Decrement reserve count
  8654.     };
  8655.  
  8656.     //  Reserve resources now so that playback can be subsequently
  8657.     //  guaranteed
  8658.     //
  8659.     //  Normally supported by a filter
  8660.     //
  8661.     [
  8662.         object,
  8663.         uuid(8389d2d0-77d7-11d1-abe6-00a0c905f375),
  8664.         pointer_default(unique),
  8665.         local
  8666.     ]
  8667.     interface IAMResourceControl : IUnknown
  8668.     {
  8669.         //  The reserve count is incremented/decremented if and only if
  8670.         //  S_OK is returned
  8671.         //  Unreserve once for every Reserve call
  8672.         HRESULT Reserve(
  8673.             [in] DWORD dwFlags,          //  From _AMRESCTL_RESERVEFLAGS enum
  8674.             [in] PVOID pvReserved        //  Must be NULL
  8675.         );
  8676.     }
  8677.  
  8678.  
  8679.     //  Set clock adjustments - supported by some clocks
  8680.     [
  8681.         object,
  8682.         uuid(4d5466b0-a49c-11d1-abe8-00a0c905f375),
  8683.         pointer_default(unique),
  8684.         local
  8685.     ]
  8686.     interface IAMClockAdjust : IUnknown
  8687.     {
  8688.         //  Set the following delta to clock times
  8689.         //  The clock will add adjust its times by the given delta
  8690.         HRESULT SetClockDelta(
  8691.             [in] REFERENCE_TIME rtDelta
  8692.         );
  8693.     };
  8694.  
  8695.     //  Filter miscellaneous status flags
  8696.  
  8697.     enum _AM_FILTER_MISC_FLAGS {
  8698.         AM_FILTER_MISC_FLAGS_IS_RENDERER = 0x00000001, /* Will deliver EC_COMPLETE
  8699.                                                          at end of media */
  8700.         AM_FILTER_MISC_FLAGS_IS_SOURCE   = 0x00000002  /*  Filter sources data */
  8701.     };
  8702.  
  8703.     [
  8704.         object,
  8705.         uuid(2dd74950-a890-11d1-abe8-00a0c905f375),
  8706.         pointer_default(unique),
  8707.         local
  8708.     ]
  8709.     interface IAMFilterMiscFlags : IUnknown
  8710.     {
  8711.         //  Get miscellaneous property flags
  8712.         ULONG GetMiscFlags(void);
  8713.     };
  8714.  
  8715.  
  8716.     // Video Image drawing interface
  8717.     [
  8718.         object,
  8719.         local,
  8720.         uuid(48efb120-ab49-11d2-aed2-00a0c995e8d5),
  8721.         pointer_default(unique),
  8722.     ]
  8723.     interface IDrawVideoImage : IUnknown
  8724.     {
  8725.         HRESULT DrawVideoImageBegin();
  8726.  
  8727.         HRESULT DrawVideoImageEnd();
  8728.  
  8729.         HRESULT DrawVideoImageDraw(
  8730.             [in] HDC hdc,
  8731.             [in] LPRECT lprcSrc,
  8732.             [in] LPRECT lprcDst
  8733.         );
  8734.     }
  8735.  
  8736.     //
  8737.     // Video Image decimation interface
  8738.     //
  8739.     // The aim of this interface is to enable a video renderer filter to
  8740.     // control the decimation properties of a video decoder connected to
  8741.     // the video renderer
  8742.     //
  8743.     // This interface should only be supported by decoders that are capable of
  8744.     // decimating their output image by an arbitary amount.
  8745.     //
  8746.     //
  8747.     [
  8748.         object,
  8749.         local,
  8750.         uuid(2e5ea3e0-e924-11d2-b6da-00a0c995e8df),
  8751.         pointer_default(unique),
  8752.     ]
  8753.     interface IDecimateVideoImage : IUnknown
  8754.     {
  8755.         //
  8756.         // Informs the decoder that it should decimate its output
  8757.         // image to the specified width and height.  If the decoder can
  8758.         // decimate to this size it should return S_OK.
  8759.         // If the decoder can't perform the requested decimation
  8760.         // or wants to stop performing the decimation that it is
  8761.         // currently doing it should return E_FAIL.
  8762.         //
  8763.         HRESULT SetDecimationImageSize(
  8764.             [in] long lWidth,
  8765.             [in] long lHeight);
  8766.  
  8767.         //
  8768.         // Informs the decoder that it should stop decimating its output image
  8769.         // and resume normal output.
  8770.         //
  8771.         HRESULT ResetDecimationImageSize();
  8772.     }
  8773.  
  8774.     typedef enum _DECIMATION_USAGE {
  8775.         DECIMATION_LEGACY,              // decimate at ovly then video port then crop
  8776.         DECIMATION_USE_DECODER_ONLY,    // decimate image at the decoder only
  8777.         DECIMATION_USE_VIDEOPORT_ONLY,  // decimate at the video port only
  8778.         DECIMATION_USE_OVERLAY_ONLY,    // decimate at the overlay only
  8779.         DECIMATION_DEFAULT              // decimate at decoder then ovly the vide port then crop
  8780.     } DECIMATION_USAGE;
  8781.  
  8782.     [
  8783.         object,
  8784.         local,
  8785.         uuid(60d32930-13da-11d3-9ec6-c4fcaef5c7be),
  8786.         pointer_default(unique),
  8787.     ]
  8788.     interface IAMVideoDecimationProperties: IUnknown
  8789.     {
  8790.         //
  8791.         // Queries the current usage of the above IDecimateVideoImage
  8792.         // interface.
  8793.         //
  8794.         HRESULT QueryDecimationUsage(
  8795.             [out] DECIMATION_USAGE* lpUsage);       // from DECIMATION_USAGE enum
  8796.  
  8797.         //
  8798.         // Sets the current usage of the above IDecimateVideoImage
  8799.         // interface.
  8800.         //
  8801.         HRESULT SetDecimationUsage(
  8802.             [in] DECIMATION_USAGE Usage);           // from DECIMATION_USAGE enum
  8803.     }
  8804.  
  8805.     //---------------------------------------------------------------------
  8806.     //
  8807.     // IVideoFrameStep interface
  8808.     //
  8809.     //---------------------------------------------------------------------
  8810.  
  8811.     [
  8812.         object,
  8813.         uuid(e46a9787-2b71-444d-a4b5-1fab7b708d6a),
  8814.         pointer_default(unique),
  8815.     ]
  8816.     interface IVideoFrameStep : IUnknown
  8817.     {
  8818.         //
  8819.         //  Stop(), Pause(), Run() all cancel Step as does any seeking
  8820.         //  request.
  8821.         //
  8822.         //  The Step() and CancelStep() methods of this interface
  8823.         //  Cancel any previous step.
  8824.         //
  8825.         //  When stepping is complete EC_STEP_COMPLETE is signalled.
  8826.         //
  8827.         //  When the filter graph gets EC_STEP_COMPLETE it automatically
  8828.         //  sets the filter graph into paused state and forwards the
  8829.         //  notification to the application
  8830.         //
  8831.         //  Returns S_OK if stepping initiated.
  8832.         //
  8833.         //  dwFrames
  8834.         //    1 means step 1 frame forward
  8835.         //    0 is invalid
  8836.         //    n (n > 1) means skip n - 1 frames and show the nth
  8837.         //
  8838.         //  pStepObject
  8839.         //    NULL - default step object (filter) picked
  8840.         //    non-NULL - use this object for stepping
  8841.         //
  8842.         HRESULT Step(DWORD dwFrames, [unique] IUnknown *pStepObject);
  8843.  
  8844.         //  Can step?
  8845.         //  Returns S_OK if it can, S_FALSE if it can't or error code.
  8846.         //  bMultiple - if TRUE return whether can step n > 1
  8847.         HRESULT CanStep(long bMultiple, [unique] IUnknown *pStepObject);
  8848.  
  8849.         //  Cancel stepping
  8850.         HRESULT CancelStep();
  8851.     }
  8852.  
  8853.  
  8854.  
  8855.  
  8856.     //---------------------------------------------------------------------
  8857.     //
  8858.     // IAMPushSource interface
  8859.     //
  8860.     // Provides a means for source filters to describe information about the
  8861.     // data that they source, such as whether the data is live or not, and
  8862.     // what type of clock was used for timestamps. This information may be
  8863.     // needed by other clocks in the graph in order to provide accurate
  8864.     // synchronization. Also provides a way to specify an offset value for
  8865.     // the filter to use when timestamping the streams it sources. Provides
  8866.     // support for the IAMLatency interface as well.
  8867.     //
  8868.     //---------------------------------------------------------------------
  8869.  
  8870.     enum _AM_PUSHSOURCE_FLAGS {
  8871.  
  8872.         //
  8873.         // The default assumption is that the data is from a live source,
  8874.         // time stamped with the graph clock, and the source does not
  8875.         // attempt to rate match the data it delivers.
  8876.         // The following flags can be used to override this assumption.
  8877.         //
  8878.  
  8879.         // capability flags
  8880.         AM_PUSHSOURCECAPS_INTERNAL_RM        = 0x00000001,  // source provides internal support for rate matching
  8881.         AM_PUSHSOURCECAPS_NOT_LIVE           = 0x00000002,  // don't treat source data as live
  8882.         AM_PUSHSOURCECAPS_PRIVATE_CLOCK      = 0x00000004,  // source data timestamped with clock not
  8883.                                                             // exposed to the graph
  8884.  
  8885.         // request flags, set by user via SetPushSourceFlags method
  8886.         AM_PUSHSOURCEREQS_USE_STREAM_CLOCK   = 0x00010000   // source was requested to timestamp
  8887.                                                             // using a clock that isn't the graph clock
  8888.     };
  8889.  
  8890.     //
  8891.     // Used to set a source filter to run in a "live" mode.
  8892.     //
  8893.     [
  8894.     object,
  8895.         uuid(F185FE76-E64E-11d2-B76E-00C04FB6BD3D),
  8896.         pointer_default(unique)
  8897.     ]
  8898.     interface IAMPushSource : IAMLatency
  8899.     {
  8900.         // used to discover push source's capabilities.
  8901.         // may be any combination of the AM_PUSHSOURCE_FLAGS flags.
  8902.         HRESULT GetPushSourceFlags (
  8903.             [out] ULONG *pFlags
  8904.         );
  8905.  
  8906.         // used to set request flags for a push source.
  8907.         // may be a combination of the AM_PUSHSOURCE_REQS_xxx flags.
  8908.         HRESULT SetPushSourceFlags (
  8909.             [in]  ULONG Flags
  8910.         );
  8911.  
  8912.         // specify an offset for push source time stamps
  8913.         HRESULT SetStreamOffset (
  8914.             [in]  REFERENCE_TIME  rtOffset
  8915.         );
  8916.  
  8917.         // retrieve the offset this push source is using
  8918.         HRESULT GetStreamOffset (
  8919.             [out] REFERENCE_TIME  *prtOffset
  8920.         );
  8921.  
  8922.         // retrieve the maximum stream offset this push source thinks it can support
  8923.         HRESULT GetMaxStreamOffset (
  8924.             [out] REFERENCE_TIME  *prtMaxOffset
  8925.         );
  8926.  
  8927.         // allows the filter graph to tell a push source the maximum latency allowed on the graph
  8928.         // this allows pins like the video capture preview pin to be more efficient with the amount
  8929.         // of buffering required to support the maximum graph latency
  8930.         HRESULT SetMaxStreamOffset (
  8931.             [in] REFERENCE_TIME  rtMaxOffset
  8932.         );
  8933.     };
  8934.  
  8935.  
  8936.     // ------------------------------------------------------------------------
  8937.     //
  8938.     // IAMDeviceRemoval interface
  8939.     //
  8940.     // Implemented by filters to request and receive WM_DEVICECHANGE
  8941.     // notifications
  8942.     //
  8943.     // ------------------------------------------------------------------------
  8944.  
  8945.     [
  8946.             object,
  8947.             uuid(f90a6130-b658-11d2-ae49-0000f8754b99),
  8948.             pointer_default(unique)
  8949.     ]
  8950.     interface IAMDeviceRemoval : IUnknown
  8951.     {
  8952.  
  8953.         HRESULT DeviceInfo(
  8954.             [out] CLSID *pclsidInterfaceClass,
  8955.             [out] WCHAR **pwszSymbolicLink);
  8956.  
  8957.         HRESULT Reassociate();
  8958.  
  8959.         HRESULT Disassociate();
  8960.     }
  8961.  
  8962.     //
  8963.     // for DV
  8964.     //
  8965.     typedef struct {
  8966.         //for 1st 5/6 DIF seq.
  8967.         DWORD dwDVAAuxSrc;
  8968.         DWORD dwDVAAuxCtl;
  8969.         //for 2nd  5/6 DIF seq.
  8970.         DWORD dwDVAAuxSrc1;
  8971.         DWORD dwDVAAuxCtl1;
  8972.         //for video information
  8973.         DWORD dwDVVAuxSrc;
  8974.         DWORD dwDVVAuxCtl;
  8975.         DWORD dwDVReserved[2];
  8976.  
  8977.     } DVINFO, *PDVINFO;
  8978.  
  8979.     // ------------------------------------------------------------------------
  8980.     //
  8981.     // IDVEnc interface
  8982.     //
  8983.     // Implemented by DV encoder filters to set Encoder format
  8984.     //
  8985.     // ------------------------------------------------------------------------
  8986.     enum _DVENCODERRESOLUTION {         //resolution
  8987.         DVENCODERRESOLUTION_720x480     =   2012,
  8988.         DVENCODERRESOLUTION_360x240     =   2013,
  8989.         DVENCODERRESOLUTION_180x120     =   2014,
  8990.         DVENCODERRESOLUTION_88x60       =   2015
  8991.     };
  8992.     enum _DVENCODERVIDEOFORMAT {        //PAL/ntsc
  8993.         DVENCODERVIDEOFORMAT_NTSC       =   2000,
  8994.         DVENCODERVIDEOFORMAT_PAL        =   2001
  8995.     };
  8996.     enum _DVENCODERFORMAT {     // dvsd/dvhd/dvsl
  8997.         DVENCODERFORMAT_DVSD        =   2007,
  8998.         DVENCODERFORMAT_DVHD        =   2008,
  8999.         DVENCODERFORMAT_DVSL        =   2009
  9000.     };
  9001.     [
  9002.             object,
  9003.             uuid(d18e17a0-aacb-11d0-afb0-00aa00b67a42),
  9004.             pointer_default(unique)
  9005.     ]
  9006.     interface IDVEnc : IUnknown
  9007.     {
  9008.  
  9009.         HRESULT get_IFormatResolution (
  9010.             [out] int *VideoFormat,  //pal or ntsc
  9011.             [out] int *DVFormat,     //dvsd dvhd dvsl
  9012.             [out] int *Resolution,   //720, 360, 180,88
  9013.             [in]  BYTE fDVInfo,      //TRUE: DVINFO structure exist, FALSE: Do not care DVINFO
  9014.             [out] DVINFO *sDVInfo    //NULL if fDVInfo=FALSE,
  9015.         );
  9016.  
  9017.        HRESULT put_IFormatResolution (
  9018.             [in] int VideoFormat,
  9019.             [in] int DVFormat,
  9020.             [in] int Resolution,    
  9021.             [in] BYTE fDVInfo,       //TRUE: DVINFO structure exist, FALSE: Do not care DVINFO
  9022.             [in] DVINFO *sDVInfo     //NULL if fDVInfo=FALSE,
  9023.         );
  9024.  
  9025.     }
  9026.  
  9027.     // ------------------------------------------------------------------------
  9028.     //
  9029.     // IDVDec interface
  9030.     //
  9031.     // Implemented by DV decoder filters to set decoder size
  9032.     //
  9033.     // ------------------------------------------------------------------------
  9034.     enum _DVDECODERRESOLUTION {
  9035.         DVDECODERRESOLUTION_720x480     =   1000,
  9036.         DVDECODERRESOLUTION_360x240     =   1001,
  9037.         DVDECODERRESOLUTION_180x120     =   1002,
  9038.         DVDECODERRESOLUTION_88x60       =   1003
  9039.     };
  9040.     enum _DVRESOLUTION {
  9041.         DVRESOLUTION_FULL       =   1000,  
  9042.         DVRESOLUTION_HALF       =   1001,
  9043.         DVRESOLUTION_QUARTER        =   1002,
  9044.         DVRESOLUTION_DC         =   1003
  9045.     };
  9046.     [
  9047.             object,
  9048.             uuid(b8e8bd60-0bfe-11d0-af91-00aa00b67a42),
  9049.             pointer_default(unique)
  9050.     ]
  9051.     interface IIPDVDec : IUnknown
  9052.     {
  9053.         HRESULT get_IPDisplay (
  9054.                 [out] int *displayPix       // The display pixels arrage
  9055.                      );
  9056.  
  9057.         HRESULT put_IPDisplay (
  9058.                  [in] int displayPix        // Change to this display pixel arrage
  9059.                      ) ;
  9060.     }
  9061.  
  9062.     // ------------------------------------------------------------------------
  9063.     //
  9064.     // IDVSplitter interface
  9065.     //
  9066.     // Implemented by DV splitter filters
  9067.     //
  9068.     // ------------------------------------------------------------------------
  9069.     [
  9070.         object,
  9071.         uuid(92a3a302-da7c-4a1f-ba7e-1802bb5d2d02)
  9072.     ]
  9073.     interface IDVSplitter : IUnknown
  9074.     {
  9075.         HRESULT DiscardAlternateVideoFrames(
  9076.                 [in] int nDiscard
  9077.                      ) ;
  9078.     }
  9079.  
  9080.     //  Audio Renderer statistics params for IAMAudioRendererStats interface
  9081.     enum _AM_AUDIO_RENDERER_STAT_PARAM {
  9082.         AM_AUDREND_STAT_PARAM_BREAK_COUNT = 1,     // audio breaks
  9083.         AM_AUDREND_STAT_PARAM_SLAVE_MODE,          // current slave mode, see AM_AUDREND_SLAVE_MODEs
  9084.         AM_AUDREND_STAT_PARAM_SILENCE_DUR,         // silence inserted due to gaps (ms)
  9085.         AM_AUDREND_STAT_PARAM_LAST_BUFFER_DUR,     // duration of the last buffer received
  9086.         AM_AUDREND_STAT_PARAM_DISCONTINUITIES,     // discontinuities seen since running
  9087.         AM_AUDREND_STAT_PARAM_SLAVE_RATE,          // what rate are we currently slaving at? S_FALSE if not slaving
  9088.         AM_AUDREND_STAT_PARAM_SLAVE_DROPWRITE_DUR, // for waveOut slaving - data dropped or added to stay in-sync
  9089.                                                    //       dwParam1 - dropped duration(ms)
  9090.                                                    //       dwParam2 - paused duration(ms)
  9091.         AM_AUDREND_STAT_PARAM_SLAVE_HIGHLOWERROR,  // highest & lowest clock differences seen
  9092.                                                    //       dwParam1 - high err
  9093.                                                    //       dwParam2 - low err
  9094.         AM_AUDREND_STAT_PARAM_SLAVE_LASTHIGHLOWERROR, // last high and low errs seen
  9095.                                                    //       dwParam1 - last high err
  9096.                                                    //       dwParam2 - last low err
  9097.         AM_AUDREND_STAT_PARAM_SLAVE_ACCUMERROR,    // error between master/slave clocks
  9098.         AM_AUDREND_STAT_PARAM_BUFFERFULLNESS,      // percent audio buffer fullness
  9099.         AM_AUDREND_STAT_PARAM_JITTER               // input buffer jitter
  9100.     };
  9101.  
  9102.     //---------------------------------------------------------------------
  9103.     //
  9104.     // IAMAudioRendererStats interface
  9105.     //
  9106.     // Interface to get at statistical information that is optionally stored
  9107.     // in an audio renderer filter. Supported on the filter interface (although
  9108.     // this might be better for ksproxy if we define it as a pin interface?)
  9109.     //
  9110.     //---------------------------------------------------------------------
  9111.  
  9112.     [
  9113.     object,
  9114.         uuid(22320CB2-D41A-11d2-BF7C-D7CB9DF0BF93),
  9115.         pointer_default(unique)
  9116.     ]
  9117.     interface IAMAudioRendererStats : IUnknown
  9118.     {
  9119.         // Get value corresponding to the passed in parameter id
  9120.         HRESULT GetStatParam(
  9121.             [in]   DWORD     dwParam,
  9122.             [out]  DWORD     *pdwParam1,
  9123.             [out]  DWORD     *pdwParam2
  9124.         );
  9125.     }
  9126.  
  9127.     //---------------------------------------------------------------------
  9128.     //
  9129.     // IAMLatency interface
  9130.     //
  9131.     // Allows a filter to report the expected latency associated with a data
  9132.     // stream flowing from its input to output pin. Supported on output pins.
  9133.     //
  9134.     //---------------------------------------------------------------------
  9135.  
  9136.     [
  9137.     object,
  9138.         uuid(62EA93BA-EC62-11d2-B770-00C04FB6BD3D),
  9139.         pointer_default(unique)
  9140.     ]
  9141.     interface IAMLatency : IUnknown
  9142.     {
  9143.         HRESULT GetLatency(
  9144.             [in]   REFERENCE_TIME  *prtLatency
  9145.         );
  9146.     }
  9147.  
  9148.  
  9149.     enum _AM_INTF_SEARCH_FLAGS {
  9150.         AM_INTF_SEARCH_INPUT_PIN  = 0x00000001,   // search input pins
  9151.         AM_INTF_SEARCH_OUTPUT_PIN = 0x00000002,   // search output pins
  9152.         AM_INTF_SEARCH_FILTER     = 0x00000004    // search filters
  9153.     };
  9154.  
  9155.     //---------------------------------------------------------------------
  9156.     //
  9157.     // IAMGraphStreams interface
  9158.     //
  9159.     // Interface used to control or search over connected streams of data
  9160.     // flow within a filter graph.
  9161.     //
  9162.     //---------------------------------------------------------------------
  9163.  
  9164.     [
  9165.     object,
  9166.         uuid(632105FA-072E-11d3-8AF9-00C04FB6BD3D),
  9167.         pointer_default(unique)
  9168.     ]
  9169.     interface IAMGraphStreams : IUnknown
  9170.     {
  9171.         // Search upstream from the current pin, for the specified interface.
  9172.         // dwFlags can be any combination of the AM_INTF_SEARCH_FLAGS, and allows
  9173.         // control over what objects to search. A value of 0 means to search all.
  9174.         HRESULT FindUpstreamInterface(
  9175.             [in]                IPin *pPin,
  9176.             [in]                REFIID riid,
  9177.             [out, iid_is(riid)] void **ppvInterface,
  9178.             [in]                DWORD dwFlags );
  9179.  
  9180.         // Enable or disable the graph's setting of a timestamp offset
  9181.         // on push sources.
  9182.         HRESULT SyncUsingStreamOffset( [in] BOOL bUseStreamOffset );
  9183.  
  9184.         // allow an app to set the maximum offset used on push source filters
  9185.         HRESULT SetMaxGraphLatency( [in] REFERENCE_TIME rtMaxGraphLatency );
  9186.     }
  9187.  
  9188.  
  9189.     //
  9190.     // IAMOverlayFX
  9191.     //
  9192.     // This interface is exposed by the overlay mixer filter and allows
  9193.     // an application to apply various "effects" to the overlay surface
  9194.     // used by the overlay mixer.
  9195.     //
  9196.     // The effects that can be applied are described by the AMOVERLAYFX
  9197.     // enumeration.
  9198.     //
  9199.     enum AMOVERLAYFX {
  9200.         // Normal (ie. top down, left to right) video
  9201.         AMOVERFX_NOFX =             0x00000000,
  9202.  
  9203.         // Mirror the overlay across the vertical axis
  9204.         AMOVERFX_MIRRORLEFTRIGHT =  0x00000002,
  9205.  
  9206.          // Mirror the overlay across the horizontal axis
  9207.         AMOVERFX_MIRRORUPDOWN =     0x00000004,
  9208.  
  9209.         // Deinterlace the overlay, if possible
  9210.         AMOVERFX_DEINTERLACE =      0x00000008
  9211.     };
  9212.  
  9213.     [
  9214.     object,
  9215.         uuid(62fae250-7e65-4460-bfc9-6398b322073c),
  9216.         pointer_default(unique)
  9217.     ]
  9218.     interface IAMOverlayFX : IUnknown
  9219.     {
  9220.         // Use this method to determine what overlay effects are currently available
  9221.         // for the overlay surface used by the overlay mixer filter.
  9222.         //
  9223.         HRESULT QueryOverlayFXCaps(
  9224.             [out] DWORD *lpdwOverlayFXCaps
  9225.             );
  9226.  
  9227.         // Use this method to apply a new overlay effect to the overlay surface
  9228.         // used by the overlay mixer filter.  This method can be called while the
  9229.         // filter graph is running, the effect is applied immediately
  9230.         //
  9231.         HRESULT SetOverlayFX(
  9232.             [in] DWORD dwOverlayFX
  9233.             );
  9234.  
  9235.         // Use this method to determine what effect (if any) is currently being
  9236.         // applied to the overlay surface by the overlay mixer filter.
  9237.         //
  9238.         HRESULT GetOverlayFX(
  9239.             [out] DWORD *lpdwOverlayFX
  9240.             );
  9241.     }   
  9242.  
  9243.  
  9244.  
  9245.     // IAMOpenProgress interface provides information about current progress through
  9246.     // a download
  9247.  
  9248.     // NOTE: The following cpp_quote is there to make sure that we do not break the whistler build when this file is
  9249.     // updated in Whistler as they are using a private copy of op.h which is removed as a result of moving the IAMOpenProgress
  9250.     // interface into axextend.idl. Html+time has a private copy of op.h in \\index1\src\newnt\inetcore\mshtml\src\time\include\op.h
  9251.     // which needs to be removed when integrating into Whistler to avoid any future build breaks.
  9252.     cpp_quote("#define __OP_H__")
  9253.  
  9254.     [
  9255.     object,
  9256.     uuid(8E1C39A1-DE53-11cf-AA63-0080C744528D),
  9257.     pointer_default(unique)
  9258.     ]
  9259.  
  9260.     interface IAMOpenProgress : IUnknown
  9261.     {
  9262.         // QueryProgress can be used to query the source filter which supports this interface
  9263.         // for progress information during a renderfile operation.
  9264.         HRESULT QueryProgress(
  9265.               [out] LONGLONG* pllTotal,
  9266.               [out] LONGLONG* pllCurrent
  9267.              );
  9268.  
  9269.         // AbortOperation can be used to request an abort of RenderFile operation
  9270.         // causing it to stop downloading. This methods instructs the exporter of
  9271.         // the IAMOpenProgress interface to hold up their internal abort flag until
  9272.         // further notice.
  9273.         HRESULT AbortOperation(
  9274.             );
  9275.     }
  9276.  
  9277.     /*++
  9278.         IMpeg2Demultiplexer
  9279.     
  9280.         This interface is implemented by the MPEG-2 Demultiplexer filter, 
  9281.         irrespective of program vs. transport stream splitting functionality.
  9282.     --*/
  9283.     [
  9284.         object,
  9285.         local,
  9286.         uuid (436eee9c-264f-4242-90e1-4e330c107512),
  9287.         pointer_default(unique)
  9288.     ]
  9289.     interface IMpeg2Demultiplexer : IUnknown
  9290.     {
  9291.         /*++
  9292.             ------------------------------------------------------------------------
  9293.             purpose:    Creates an output pin of the specified media type.
  9294.         
  9295.             pMediaType      media type specifier for the new pin
  9296.             pszPinName      pin name; cannot be a duplicate of an existing pin
  9297.             ppIPin          IPin interface pointer to the newly created pin
  9298.         --*/
  9299.         HRESULT
  9300.         CreateOutputPin (
  9301.             [in]    AM_MEDIA_TYPE * pMediaType,
  9302.             [in]    LPWSTR          pszPinName,
  9303.             [out]   IPin **         ppIPin
  9304.             ) ;
  9305.         
  9306.         /*++
  9307.             ------------------------------------------------------------------------
  9308.             purpose:    Updates the media type of the specified output pin.  If no
  9309.                           connection exists, the media type is updated always.  If
  9310.                           the pin is connected, the success/failure of the call will
  9311.                           depend on downstream input pin's accetance/rejection of
  9312.                           the specified media type, and subsequent success/failure
  9313.                           of a reconnect.
  9314.         
  9315.             pszPinName      pin name
  9316.             pMediaType      new media type specifier
  9317.         --*/
  9318.         HRESULT
  9319.         SetOutputPinMediaType (
  9320.             [in]    LPWSTR          pszPinName,
  9321.             [in]    AM_MEDIA_TYPE * pMediaType
  9322.             ) ;
  9323.         
  9324.         /*++
  9325.             ------------------------------------------------------------------------
  9326.             purpose:    Deletes the specified output pin.
  9327.         
  9328.             pszPinName      pin name
  9329.         --*/
  9330.         HRESULT
  9331.         DeleteOutputPin (
  9332.             [in]    LPWSTR  pszPinName
  9333.             ) ;
  9334.     } ;
  9335.  
  9336.     //---------------------------------------------------------------------
  9337.     // IEnumStreamIdMap interface
  9338.     //---------------------------------------------------------------------
  9339.  
  9340.     cpp_quote("#define MPEG2_PROGRAM_STREAM_MAP                 0x00000000")
  9341.     cpp_quote("#define MPEG2_PROGRAM_ELEMENTARY_STREAM          0x00000001")
  9342.     cpp_quote("#define MPEG2_PROGRAM_DIRECTORY_PES_PACKET       0x00000002")
  9343.     cpp_quote("#define MPEG2_PROGRAM_PACK_HEADER                0x00000003")
  9344.     cpp_quote("#define MPEG2_PROGRAM_PES_STREAM                 0x00000004")
  9345.     cpp_quote("#define MPEG2_PROGRAM_SYSTEM_HEADER              0x00000005")
  9346.  
  9347.     cpp_quote("#define SUBSTREAM_FILTER_VAL_NONE                0x10000000")
  9348.  
  9349.     typedef struct {
  9350.         ULONG   stream_id ;                     //  mpeg-2 stream_id
  9351.         DWORD   dwMediaSampleContent ;          //  #define'd above
  9352.         ULONG   ulSubstreamFilterValue ;        //  filtering value
  9353.         int     iDataOffset ;                   //  offset to elementary stream
  9354.     } STREAM_ID_MAP ;
  9355.  
  9356.     /*++
  9357.         Enumerates the StreamIds mapped on a pin
  9358.     --*/
  9359.     [
  9360.         object,
  9361.         local,
  9362.         uuid (945C1566-6202-46fc-96C7-D87F289C6534),
  9363.         pointer_default(unique)
  9364.     ]
  9365.     interface IEnumStreamIdMap : IUnknown
  9366.     {
  9367.         HRESULT
  9368.         Next (
  9369.             [in]                            ULONG           cRequest,
  9370.             [in, out, size_is (cRequest)]   STREAM_ID_MAP * pStreamIdMap,
  9371.             [out]                           ULONG *         pcReceived
  9372.             ) ;
  9373.  
  9374.         HRESULT
  9375.         Skip (
  9376.             [in]    ULONG   cRecords
  9377.             ) ;
  9378.  
  9379.         HRESULT
  9380.         Reset (
  9381.             ) ;
  9382.  
  9383.         HRESULT
  9384.         Clone (
  9385.             [out]   IEnumStreamIdMap **  ppIEnumStreamIdMap
  9386.             ) ;
  9387.     } ;
  9388.  
  9389.     /*++
  9390.         Implemented on the output pin.
  9391.     
  9392.         Provides the ability to map/unmap a stream_id to/from an output pin.
  9393.     --*/
  9394.     [
  9395.         object,
  9396.         local,
  9397.         uuid (D0E04C47-25B8-4369-925A-362A01D95444),
  9398.         pointer_default(unique)
  9399.     ]
  9400.     interface IMPEG2StreamIdMap : IUnknown
  9401.     {
  9402.         HRESULT
  9403.         MapStreamId (
  9404.             [in]    ULONG   ulStreamId,                 //  mpeg-2 stream_id
  9405.             [in]    DWORD   MediaSampleContent,         //  #define'd above IEnumStreamIdMap
  9406.             [in]    ULONG   ulSubstreamFilterValue,     //  filter value
  9407.             [in]    int     iDataOffset                 //  elementary stream offset
  9408.             ) ;
  9409.  
  9410.         HRESULT
  9411.         UnmapStreamId (
  9412.             [in]    ULONG   culStreamId,                //  number of stream_id's in pulStreamId
  9413.             [in]    ULONG * pulStreamId                 //  array of stream_id's to unmap
  9414.             ) ;
  9415.  
  9416.         HRESULT
  9417.         EnumStreamIdMap (
  9418.             [out]   IEnumStreamIdMap ** ppIEnumStreamIdMap
  9419.             ) ;
  9420.     } ;
  9421.  
  9422.  
  9423. #endif    // DirectX 8.0 content
  9424.